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 54A473E1712 for ; Fri, 12 Jun 2026 07:48:20 +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=1781250501; cv=none; b=kBCT3ooVnWHWQv+AVCVhHUCJPMAzLh1JSI13HDNE9/KycQqfNowge+7Fq8KJqqKhjT9KNoghUuZjl3egLOxqJOn88dSxyKxBez4FLibQYXWpjQfQsmfq88+2sv76874UlVClIawVaPrrLvihvVCvfDtwJ7t43I0m0c9Br52rHdk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781250501; c=relaxed/simple; bh=rxbWvJGrUdHSycKBj3EgO7EPWxn5Y1Ounda3TNjVUTA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A2ucqaBC9doW5PmVvDkl0oIOACxWqWNgpmSBbwvjMofxLvXLpGb+l1W/yyjktbMgNiqcIc9O52j2rDfzx6NhwNFV9p7dkNk988M2i1SEJkFHABP5PNC/6/HATDWFUjqUby0vsc9RxNVUOeVcwTd8tuNpikes3gMydfTG2tsrneE= 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=wacxgzd5; 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="wacxgzd5" Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id 029AB20754; Fri, 12 Jun 2026 09:48:19 +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 9oSHk1kYHRuy; Fri, 12 Jun 2026 09:48:18 +0200 (CEST) Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (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 6C638206D2; Fri, 12 Jun 2026 09:48:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 6C638206D2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1781250498; bh=FMaSkdokqeUjyYABhHlw8iEz4pEBGgzSXGKP/Zz4dpA=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=wacxgzd56eq7uBB9UP04H+C0NKoV6IU1F/kZUgnYHhvrpkebTCAKWCZWw+Aisr+Hb 6YQLXQp/pM+1R03jx9IID6f6p5cueZX9t7x1ZQ272qIoAtwnO1Bh1bQFVIZY3un1jb fppzRmnqyfXKBrP7hVEzjhZ38pmx6df0e2rgYJxRgAIeA7kFxQ02Nr0LFd0RI8okmg BoN1eTb7GQZopmjpqo7B3sIIzXlDysvQrbEoNFxqzzD9tyUFArCS/W9lK37OiHUjLO XRuCyHyiSkZrA5JQ52CfrKj7h/QExyjJP4Wijt6IK+OMPugsMNROfxp/TvQ4VC4yfF jKoD3PDrZw8Ig== Received: from secunet.com (10.182.7.193) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Fri, 12 Jun 2026 09:48:17 +0200 Received: (nullmailer pid 1768296 invoked by uid 1000); Fri, 12 Jun 2026 07:47:57 -0000 From: Steffen Klassert To: David Miller , Jakub Kicinski CC: Herbert Xu , Steffen Klassert , Subject: [PATCH 11/18] xfrm: add error messages to state migration Date: Fri, 12 Jun 2026 09:46:27 +0200 Message-ID: <20260612074725.1760473-12-steffen.klassert@secunet.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260612074725.1760473-1-steffen.klassert@secunet.com> References: <20260612074725.1760473-1-steffen.klassert@secunet.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-04.secunet.de (10.32.0.184) To EXCH-01.secunet.de (10.32.0.171) From: Antony Antony 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 Signed-off-by: Steffen Klassert --- 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.43.0