From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BE093C09E9; Tue, 26 May 2026 19:08:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.96.220.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779822529; cv=none; b=DoZQhpwiSogJvQe3vNQ/5BpyOlHPxE8UpY19Xja2pSsVvTn5PSdnBfLYvB5UCVCdiM1qu4QRalb7v42GKuYviSaSdFP+XKV2WfmUcv3konny+JZU2UEvHzOMPxpOhSsm9oCzkMZwfcy5i5VjIXJx7b4pYC1OVOqXXTsRVrp2jj8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779822529; c=relaxed/simple; bh=qVIMtFwXwYDocepA3+PVGiSO21SwkfhHvSToTF0QboA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dwjxvVFy7XxRZ9mMYeBrwF08mHXNBxak0xOcnco5sxXEYFcTg6aHh0fmijson53Aqul4upktrRtiv2CvEDi4ci3OeSTyPhkf1/4o3AaNlXdRjkhg9ItBiJNePWLRasCVrszf3iqfdt47/y6KWK7ybDt3GJiYRkzB9uIjbGK/U6w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b=JlkxaO5u; arc=none smtp.client-ip=62.96.220.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b="JlkxaO5u" Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id 0C904201E4; Tue, 26 May 2026 21:08:47 +0200 (CEST) X-Virus-Scanned: by secunet Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MhxqY0SGATXv; Tue, 26 May 2026 21:08:46 +0200 (CEST) Received: from EXCH-02.secunet.de (rl2.secunet.de [10.32.0.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id 75299201A7; Tue, 26 May 2026 21:08:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 75299201A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1779822526; bh=BV8GxDiIawzrv8Vy3v1rmPvKOQeKFEpIv8exqz4d6J8=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=JlkxaO5uabYCqy4q/rYj6V1S7zbMSYfNI0dEnIsGCdu0GqaUZW5o2QDgNxadh0oIP scfcQ0P5xcPfoZWSzOAdgf/dcwvH5aLt3gmVvYfUp6oNcTTSLCPFAewo+cHlcGuxxF hhfiQJREv+EO1E+UhchmnZ867WyyrobrLXdzgHvd+/MHRPoY/7P54v6iStE2mnsDnB z8aYAVeobwgdt3ccw5v3gbzIEqjDYZvsvXuMcazpVX4gLOzGLtQn8MWsdW72bw2Uzl 4w/ROrKHDhLXBXL0WaOrHgqDnVE/AxiPBhow/ZkVd2MD7zSv0vOUtgNrYHX7lBrQRv YJoAEeutAB7eA== Received: from moon.secunet.de (172.18.149.1) by EXCH-02.secunet.de (10.32.0.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Tue, 26 May 2026 21:08:43 +0200 From: Antony Antony To: Antony Antony , Steffen Klassert , Herbert Xu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , David Ahern , Masahide NAKAMURA , Paul Moore , Stephen Smalley , Ondrej Mosnacek , Jonathan Corbet , Shuah Khan CC: Sabrina Dubroca , , , , , Chiachang Wang , Yan Yan , Subject: [PATCH ipsec-next v9 09/16] xfrm: add error messages to state migration Date: Tue, 26 May 2026 21:08:29 +0200 Message-ID: X-Mailer: git-send-email 2.39.5 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15-dev Content-Transfer-Encoding: 8bit X-ClientProxiedBy: EXCH-03.secunet.de (10.32.0.183) To EXCH-02.secunet.de (10.32.0.172) Add descriptive(extack) error messages for all error paths in state migration. This improves diagnostics by providing clear feedback when migration fails. After xfrm_init_state() use NL_SET_ERR_MSG_WEAK() as fallback for error paths not yet propagating extack e.g. mode_cbs->init_state() No functional change. Reviewed-by: Sabrina Dubroca Signed-off-by: Antony Antony --- v5->v6: - in case dev_state_add() extack already set - after xfrm_init_state() use NL_SET_ERR_MSG_WEAK() as fallback v4->v5: - added this patch --- net/xfrm/xfrm_state.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index fcf6f0c6400d..1db48ecda80d 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -2130,11 +2130,15 @@ struct xfrm_state *xfrm_state_migrate_create(struct xfrm_state *x, struct xfrm_state *xc; xc = xfrm_state_clone_and_setup(x, encap, m); - if (!xc) + if (!xc) { + NL_SET_ERR_MSG(extack, "Failed to clone and setup state"); return NULL; + } - if (xfrm_init_state(xc, extack) < 0) + if (xfrm_init_state(xc, extack) < 0) { + NL_SET_ERR_MSG_WEAK(extack, "Failed to initialize migrated state"); goto error; + } /* configure the hardware if offload is requested */ if (xuo && xfrm_dev_state_add(net, xc, xuo, extack)) @@ -2163,6 +2167,7 @@ int xfrm_state_migrate_install(const struct xfrm_state *x, xfrm_state_insert(xc); } else { if (xfrm_state_add(xc) < 0) { + NL_SET_ERR_MSG(extack, "Failed to add migrated state"); if (xuo) xfrm_dev_state_delete(xc); xc->km.state = XFRM_STATE_DEAD; -- 2.47.3