From nobody Sat Feb 7 07:10:22 2026 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68E3A1E519 for ; Mon, 10 Mar 2025 16:59:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741625975; cv=none; b=naPHFi32iIwu7IaBOC+iAKyr9rfzhfjOcpnlu/nXzbn+C318T6YyuuHpRbIarm2BFtAXMaw5AL2jOAfS76Ysiw0QxTUlsWQsb8u/k8R7Pzjx0NInq8mKE46kO91KBNubO2kcodFL6i+xnbq6C8uO8qx269wUmf2m47ftGl5XXjM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741625975; c=relaxed/simple; bh=2ZRgAMr5GbjGAJINXjiicJFz+bJe8w6EItjLFFSV8cQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uLIwFgq4MozXvXRctII8i29JUcCfcXHDL5MbfDXbejFLaAhktA1v15TKqZzfDoyByj3gxLgSIm/hBHQ/WTnfbJr14dcN9LwjDDq530FfnYxVLVBSVMToayTDFKUG/XCDBx462Wj2K0ZLvidIzQhi9LSUzhxSIBr2RkDj0w6qjhk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=JL4bxYcK; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=yHiSU9I3; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=JL4bxYcK; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=yHiSU9I3; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="JL4bxYcK"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="yHiSU9I3"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="JL4bxYcK"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="yHiSU9I3" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A46F4210F4; Mon, 10 Mar 2025 16:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1741625971; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=asvK7OjCQ+r/xjTTpNpI9ccqBfRl2LGvzZZGhZs/1uo=; b=JL4bxYcK1HLtZo7fn5cXYnIA4Ul5gi3whknobgy96rdzpmKpSaiTzr8jNCNKFUqoMYhTy4 hJfLCIlm40/UKO9Fq+fqT3oj8ineJcB65b+1sYPpqubkpyI1PQRh1NmCPSozV18wRiOK6i U+/qVUaq1+IesV1e+FnN7pfaHgYX26o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1741625971; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=asvK7OjCQ+r/xjTTpNpI9ccqBfRl2LGvzZZGhZs/1uo=; b=yHiSU9I3FlyQ/zKmfdhCgiA/13J8ZKOHpWXtG8loKAOvHUA+42W4SN/H0zq+qEnjHc3WnE QU2G4mOoddI9B8AQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=JL4bxYcK; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=yHiSU9I3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1741625971; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=asvK7OjCQ+r/xjTTpNpI9ccqBfRl2LGvzZZGhZs/1uo=; b=JL4bxYcK1HLtZo7fn5cXYnIA4Ul5gi3whknobgy96rdzpmKpSaiTzr8jNCNKFUqoMYhTy4 hJfLCIlm40/UKO9Fq+fqT3oj8ineJcB65b+1sYPpqubkpyI1PQRh1NmCPSozV18wRiOK6i U+/qVUaq1+IesV1e+FnN7pfaHgYX26o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1741625971; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=asvK7OjCQ+r/xjTTpNpI9ccqBfRl2LGvzZZGhZs/1uo=; b=yHiSU9I3FlyQ/zKmfdhCgiA/13J8ZKOHpWXtG8loKAOvHUA+42W4SN/H0zq+qEnjHc3WnE QU2G4mOoddI9B8AQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 94DAE139E7; Mon, 10 Mar 2025 16:59:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 3msYI3Maz2eZaAAAD6G6ig (envelope-from ); Mon, 10 Mar 2025 16:59:31 +0000 From: Nicolai Stange To: "David S. Miller" , David Ahern Cc: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Stange Subject: [PATCH v1 1/4] ipv6: sr: reject unsupported SR HMAC algos with -ENOENT Date: Mon, 10 Mar 2025 17:58:54 +0100 Message-ID: <20250310165857.3584612-2-nstange@suse.de> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250310165857.3584612-1-nstange@suse.de> References: <20250310165857.3584612-1-nstange@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: A46F4210F4 X-Spam-Score: -3.01 X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_SEVEN(0.00)[9]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Flag: NO X-Spam-Level: Content-Type: text/plain; charset="utf-8" The IPv6 SR HMAC implementation supports sha1 and sha256, but would silently accept any other value configured for the ->alg_id -- it just would fail to create such an HMAC then. That's certainly fine, as users attempting to configure random ->alg_ids don't deserve any better. However, a subsequent patch will enable a scenario where the instantiation of a supported HMAC algorithm may fail, namely with SHA1 when booted in FIPS mode. As such an instantiation failure would depend on the system configuration, i.e. whether FIPS mode is enabled or not, it would be better to report a proper error back at configuration time rather than to e.g. silently drop packets during operation. Make __hmac_get_algo() to filter algos with ->tfms =3D=3D NULL, indicating an instantiation failure. Note that this cannot happen yet at this very moment, as the IPv6 SR HMAC __init code would have failed then. As said, it's a scenario enabled only with a subsequent patch. Make seg6_hmac_info_add() to return -ENOENT to the user in case __hmac_get_algo() fails to find a matching algo. Signed-off-by: Nicolai Stange --- net/ipv6/seg6_hmac.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c index bbf5b84a70fc..77bdb41d3b82 100644 --- a/net/ipv6/seg6_hmac.c +++ b/net/ipv6/seg6_hmac.c @@ -108,7 +108,7 @@ static struct seg6_hmac_algo *__hmac_get_algo(u8 alg_id) alg_count =3D ARRAY_SIZE(hmac_algos); for (i =3D 0; i < alg_count; i++) { algo =3D &hmac_algos[i]; - if (algo->alg_id =3D=3D alg_id) + if (algo->alg_id =3D=3D alg_id && algo->tfms) return algo; } =20 @@ -293,8 +293,13 @@ EXPORT_SYMBOL(seg6_hmac_info_lookup); int seg6_hmac_info_add(struct net *net, u32 key, struct seg6_hmac_info *hi= nfo) { struct seg6_pernet_data *sdata =3D seg6_pernet(net); + struct seg6_hmac_algo *algo; int err; =20 + algo =3D __hmac_get_algo(hinfo->alg_id); + if (!algo || !algo->tfms) + return -ENOENT; + err =3D rhashtable_lookup_insert_fast(&sdata->hmac_infos, &hinfo->node, rht_params); =20 --=20 2.47.1 From nobody Sat Feb 7 07:10:22 2026 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E847230BF3 for ; Mon, 10 Mar 2025 16:59:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741625985; cv=none; b=Fig7/rQ6rMftzULI4NBqHgLoVu4qtNPQ2xt+OBXnFU+AhXEPB+h/fttGxbN2HsuD0xXWdhAnfLMIiHC4qSTV5Wj7ApBm62lKQPJ3gE9lriKOcNpS2LXg0BsCdfm3FrxB3VvE3aSN4ecv9Ydz9PgxpOxXQT2vxvFyLhrStpaV+Qs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741625985; c=relaxed/simple; bh=WRCayP3MmhXf5xryWJtI2GbmV78ONoyo1lshSWu0AB4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aih05l6s41MQDjf6JXvaIKyQ5H5h171TVyvblTnhLYDaE7zTUw5QK6632fbLtmJzDysqa8IEafMl1fxHB8CseK+fzY5JPVmAPjD4w1Ei/yhTbAGB3fElWjci3+kyMd3mcOZcpjABaA9NgLLOgMK+pM5nUxZS8FRPTps2fHi9Ryo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=M4+ynvU6; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Fwi7KwdL; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=M4+ynvU6; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Fwi7KwdL; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="M4+ynvU6"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Fwi7KwdL"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="M4+ynvU6"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Fwi7KwdL" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 684942116F; Mon, 10 Mar 2025 16:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1741625982; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=829coLoa6VRYDjhgJeMBamrDTaVX11h9vawDyvsvboQ=; b=M4+ynvU6Qf4z/5iLvPoXjPMb5TuLXVHOsK+T0NSPHHTf2i+Fuhy+74xHGWqAtZ/bVHT1U6 7el/QMGJLzyr68cV7kgg2dwpiStPQI19UMSs/PZQXBmEaEP21UmhMQbpgGx/G8MVSAMrBx pGWTzrh7Zbl0+EuA+9n/czctpKfUJvk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1741625982; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=829coLoa6VRYDjhgJeMBamrDTaVX11h9vawDyvsvboQ=; b=Fwi7KwdLPuxSsYsf+/ZganJVVTAgF0yBqK1b9xS8Cx1LyK7FXLOLMxFeeoJ9Up3R2EEZSj cq+bho+QJwgl34BQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=M4+ynvU6; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Fwi7KwdL DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1741625982; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=829coLoa6VRYDjhgJeMBamrDTaVX11h9vawDyvsvboQ=; b=M4+ynvU6Qf4z/5iLvPoXjPMb5TuLXVHOsK+T0NSPHHTf2i+Fuhy+74xHGWqAtZ/bVHT1U6 7el/QMGJLzyr68cV7kgg2dwpiStPQI19UMSs/PZQXBmEaEP21UmhMQbpgGx/G8MVSAMrBx pGWTzrh7Zbl0+EuA+9n/czctpKfUJvk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1741625982; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=829coLoa6VRYDjhgJeMBamrDTaVX11h9vawDyvsvboQ=; b=Fwi7KwdLPuxSsYsf+/ZganJVVTAgF0yBqK1b9xS8Cx1LyK7FXLOLMxFeeoJ9Up3R2EEZSj cq+bho+QJwgl34BQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 4EA6D139E7; Mon, 10 Mar 2025 16:59:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id A7cHEn4az2e0aAAAD6G6ig (envelope-from ); Mon, 10 Mar 2025 16:59:42 +0000 From: Nicolai Stange To: "David S. Miller" , David Ahern Cc: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Stange Subject: [PATCH v1 2/4] ipv6: sr: factor seg6_hmac_exit()'s per-algo code into separate function Date: Mon, 10 Mar 2025 17:58:55 +0100 Message-ID: <20250310165857.3584612-3-nstange@suse.de> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250310165857.3584612-1-nstange@suse.de> References: <20250310165857.3584612-1-nstange@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 684942116F X-Spam-Level: X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_SEVEN(0.00)[9]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -3.01 X-Spam-Flag: NO Content-Type: text/plain; charset="utf-8" Move the per-algo cleanup code from seg6_hmac_exit() into a separate function, the new seg6_hmac_free_algo(), in order to make it accessible to upcoming error handling code at initialization time. Make seg6_hmac_free_algo() to clear out ->tfms and ->shashs in order to make it idempotent. Otherwise this is a refactoring only, there is no change in behaviour. Signed-off-by: Nicolai Stange --- net/ipv6/seg6_hmac.c | 48 +++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c index 77bdb41d3b82..2d7a400e074f 100644 --- a/net/ipv6/seg6_hmac.c +++ b/net/ipv6/seg6_hmac.c @@ -355,6 +355,31 @@ int seg6_push_hmac(struct net *net, struct in6_addr *s= addr, } EXPORT_SYMBOL(seg6_push_hmac); =20 +static void seg6_hmac_free_algo(struct seg6_hmac_algo *algo) +{ + struct crypto_shash *tfm; + struct shash_desc *shash; + int cpu; + + if (algo->shashs) { + for_each_possible_cpu(cpu) { + shash =3D *per_cpu_ptr(algo->shashs, cpu); + kfree(shash); + } + free_percpu(algo->shashs); + algo->shashs =3D NULL; + } + + if (algo->tfms) { + for_each_possible_cpu(cpu) { + tfm =3D *per_cpu_ptr(algo->tfms, cpu); + crypto_free_shash(tfm); + } + free_percpu(algo->tfms); + algo->tfms =3D NULL; + } +} + static int seg6_hmac_init_algo(void) { struct seg6_hmac_algo *algo; @@ -423,30 +448,11 @@ int __net_init seg6_hmac_net_init(struct net *net) =20 void seg6_hmac_exit(void) { - struct seg6_hmac_algo *algo =3D NULL; - struct crypto_shash *tfm; - struct shash_desc *shash; - int i, alg_count, cpu; + int i, alg_count; =20 alg_count =3D ARRAY_SIZE(hmac_algos); for (i =3D 0; i < alg_count; i++) { - algo =3D &hmac_algos[i]; - - if (algo->shashs) { - for_each_possible_cpu(cpu) { - shash =3D *per_cpu_ptr(algo->shashs, cpu); - kfree(shash); - } - free_percpu(algo->shashs); - } - - if (algo->tfms) { - for_each_possible_cpu(cpu) { - tfm =3D *per_cpu_ptr(algo->tfms, cpu); - crypto_free_shash(tfm); - } - free_percpu(algo->tfms); - } + seg6_hmac_free_algo(&hmac_algos[i]); } } EXPORT_SYMBOL(seg6_hmac_exit); --=20 2.47.1 From nobody Sat Feb 7 07:10:22 2026 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A960233134 for ; Mon, 10 Mar 2025 16:59:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741625991; cv=none; b=tca5YpOCM1gY5xeUBEGPdd2p+p1QYJBgpXAvngGN/gupmsCqtl+fQwYp802JEDiY+5qSH8Ivp/gN7ZObaR89cGVq1D0mwby9e/R0XHsEOHBdctcIexZ1brkyMsUcA8ZOpZTIFlDHahf3eMCEXuk23EWypCev8CD6GKsfUbaE780= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741625991; c=relaxed/simple; bh=bzgxmPiyxdUgwrTaKmPrMP3C4VMs5NTi+aNP325TVKw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F6Ahp0BjPZ88PZwsxhalHyXYviX465R1RzrypIqYeh/HgYk5skYQ2NfPiXPPNcE7ILgQeriEGinrusvy2FZjO6kYzr9iUKSzWWA2fyPgwG0Gucjx1w27auJYGPp34t/f3rPmcuScbh4G7mufizpN1ypsYQS4Rw1W2AljDBSrlyI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=YQOkFEWR; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=v22Bsbdw; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=YQOkFEWR; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=v22Bsbdw; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="YQOkFEWR"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="v22Bsbdw"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="YQOkFEWR"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="v22Bsbdw" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D078921171; Mon, 10 Mar 2025 16:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1741625984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WJMKt3mXLhrk9rTRNxqbtzeFb/7va0YwRZyupNReY3A=; b=YQOkFEWRxYy0eGuIHoZ+YJtrsJQ3hifftOtEHd2MczhObqG1EtU3zIQFLGzaO6HE3X2BA9 FBsKs7oW9lJfSdT5UPvRJFhmicnqHq2zH/KrJPEkKtnfKXIlIxJCW46V9ygkIDeeXr/TJD G4QEqvxGbqTjYjakYX4e2u5VsxER3WQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1741625984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WJMKt3mXLhrk9rTRNxqbtzeFb/7va0YwRZyupNReY3A=; b=v22BsbdwU76c4Bpk9H4mkKtUWriU+Rg63PmPQdL05bNiIQyvncNfALJaGbW70hidGVHTRW Ifh3n9a4COnrAECQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=YQOkFEWR; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=v22Bsbdw DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1741625984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WJMKt3mXLhrk9rTRNxqbtzeFb/7va0YwRZyupNReY3A=; b=YQOkFEWRxYy0eGuIHoZ+YJtrsJQ3hifftOtEHd2MczhObqG1EtU3zIQFLGzaO6HE3X2BA9 FBsKs7oW9lJfSdT5UPvRJFhmicnqHq2zH/KrJPEkKtnfKXIlIxJCW46V9ygkIDeeXr/TJD G4QEqvxGbqTjYjakYX4e2u5VsxER3WQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1741625984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WJMKt3mXLhrk9rTRNxqbtzeFb/7va0YwRZyupNReY3A=; b=v22BsbdwU76c4Bpk9H4mkKtUWriU+Rg63PmPQdL05bNiIQyvncNfALJaGbW70hidGVHTRW Ifh3n9a4COnrAECQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BF014139E7; Mon, 10 Mar 2025 16:59:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2yJ+LYAaz2e9aAAAD6G6ig (envelope-from ); Mon, 10 Mar 2025 16:59:44 +0000 From: Nicolai Stange To: "David S. Miller" , David Ahern Cc: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Stange Subject: [PATCH v1 3/4] ipv6: sr: factor seg6_hmac_init_algo()'s per-algo code into separate function Date: Mon, 10 Mar 2025 17:58:56 +0100 Message-ID: <20250310165857.3584612-4-nstange@suse.de> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250310165857.3584612-1-nstange@suse.de> References: <20250310165857.3584612-1-nstange@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: D078921171 X-Spam-Score: -3.01 X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_SEVEN(0.00)[9]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLpptcdopf6haxzq6q5owokncz)]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Flag: NO X-Spam-Level: Content-Type: text/plain; charset="utf-8" In order to prepare for ignoring certain instantiation failures and continue with the remaining supported algorithms, factor the per-algo initialization code into a separate function: - rename seg6_hmac_init_algo() to seg6_hmac_init_algos() and - move its per-algo initialization code into a new function, seg6_hmac_init_algo(). This is a refactoring only, there is no change in behaviour. Signed-off-by: Nicolai Stange --- net/ipv6/seg6_hmac.c | 88 ++++++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c index 2d7a400e074f..85e90d8d8050 100644 --- a/net/ipv6/seg6_hmac.c +++ b/net/ipv6/seg6_hmac.c @@ -380,51 +380,61 @@ static void seg6_hmac_free_algo(struct seg6_hmac_algo= *algo) } } =20 -static int seg6_hmac_init_algo(void) +static int seg6_hmac_init_algo(struct seg6_hmac_algo *algo) { - struct seg6_hmac_algo *algo; - struct crypto_shash *tfm; + struct crypto_shash *tfm, **p_tfm; struct shash_desc *shash; - int i, alg_count, cpu; + int cpu, shsize; int ret =3D -ENOMEM; =20 + algo->tfms =3D alloc_percpu(struct crypto_shash *); + if (!algo->tfms) + goto error_out; + + for_each_possible_cpu(cpu) { + tfm =3D crypto_alloc_shash(algo->name, 0, 0); + if (IS_ERR(tfm)) { + ret =3D PTR_ERR(tfm); + goto error_out; + } + p_tfm =3D per_cpu_ptr(algo->tfms, cpu); + *p_tfm =3D tfm; + } + + p_tfm =3D raw_cpu_ptr(algo->tfms); + tfm =3D *p_tfm; + + shsize =3D sizeof(*shash) + crypto_shash_descsize(tfm); + + algo->shashs =3D alloc_percpu(struct shash_desc *); + if (!algo->shashs) + goto error_out; + + for_each_possible_cpu(cpu) { + shash =3D kzalloc_node(shsize, GFP_KERNEL, + cpu_to_node(cpu)); + if (!shash) + goto error_out; + *per_cpu_ptr(algo->shashs, cpu) =3D shash; + } + + return 0; + +error_out: + seg6_hmac_free_algo(algo); + return ret; +} + +static int seg6_hmac_init_algos(void) +{ + int i, alg_count; + int ret; + alg_count =3D ARRAY_SIZE(hmac_algos); - for (i =3D 0; i < alg_count; i++) { - struct crypto_shash **p_tfm; - int shsize; - - algo =3D &hmac_algos[i]; - algo->tfms =3D alloc_percpu(struct crypto_shash *); - if (!algo->tfms) + ret =3D seg6_hmac_init_algo(&hmac_algos[i]); + if (ret) goto error_out; - - for_each_possible_cpu(cpu) { - tfm =3D crypto_alloc_shash(algo->name, 0, 0); - if (IS_ERR(tfm)) { - ret =3D PTR_ERR(tfm); - goto error_out; - } - p_tfm =3D per_cpu_ptr(algo->tfms, cpu); - *p_tfm =3D tfm; - } - - p_tfm =3D raw_cpu_ptr(algo->tfms); - tfm =3D *p_tfm; - - shsize =3D sizeof(*shash) + crypto_shash_descsize(tfm); - - algo->shashs =3D alloc_percpu(struct shash_desc *); - if (!algo->shashs) - goto error_out; - - for_each_possible_cpu(cpu) { - shash =3D kzalloc_node(shsize, GFP_KERNEL, - cpu_to_node(cpu)); - if (!shash) - goto error_out; - *per_cpu_ptr(algo->shashs, cpu) =3D shash; - } } =20 return 0; @@ -436,7 +446,7 @@ static int seg6_hmac_init_algo(void) =20 int __init seg6_hmac_init(void) { - return seg6_hmac_init_algo(); + return seg6_hmac_init_algos(); } =20 int __net_init seg6_hmac_net_init(struct net *net) --=20 2.47.1 From nobody Sat Feb 7 07:10:22 2026 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AE352343C1 for ; Mon, 10 Mar 2025 16:59:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741625997; cv=none; b=hRA9GpP4WtJ08S6iZC2whX6ho932cSIHZcz5HO+ZNuYynXV20fBSsPlG/kr2CAgCKAkGi+MEq3dZTPRHHS98hgrhh+FwqV+QQGmrQsqzhZ/kEr3CTTV+PXwSDDBvmbcdim0Yp9izEDoaE/jmU6MmbjfyLO7o5gB+pjfIIzq2IEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741625997; c=relaxed/simple; bh=BtxPDe8zkq/NBpYVlLij2a8ynqMMcpMY3Pfrlpgmqxs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iquHDJfJ+kRtJEV1tzQd/qyusfUK2gH8Xignx6VW0HdQdU5BoWCEgY5IcI/rNuPfsaD4k54t5VpHzoZSySL8TP2FDaNpxhmhKdyfKDI2Jrgq78Gres3SdAIoyjE/WkVpP4M8t2w8eQ9os/dPuOdeymuFb3T37Fh7pTh7ffu7PxQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=OvKZBtkS; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=yuCVoSsu; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=OvKZBtkS; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=yuCVoSsu; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="OvKZBtkS"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="yuCVoSsu"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="OvKZBtkS"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="yuCVoSsu" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8C2B621162; Mon, 10 Mar 2025 16:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1741625986; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/15a4p4/MRhFHiV3UC/tU5arF9LRXK/RyuAoe1B54Zs=; b=OvKZBtkSVIuhal8NQF+trarWxwmgq6Wiw/cbDYY8tMMfjZud9/5ATVMMxueNOwlHZGMuUI M29AcdqxQMrs9/5VIGuPJbYtA2lUavwVe3kcYb96TTYhR2vFbh4AFrCSy8VhIxR4O2mevj n07uNHkaE1+cYHhDSzY6jEsRuSliWxk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1741625986; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/15a4p4/MRhFHiV3UC/tU5arF9LRXK/RyuAoe1B54Zs=; b=yuCVoSsuVODwm2e/wNVO6b67HB9RlLPhbzlO3ATIFQBPElZ0sdOsDYG4LnVoHXS38M8rJP 8Fjj6sLzzb6BZBAQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1741625986; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/15a4p4/MRhFHiV3UC/tU5arF9LRXK/RyuAoe1B54Zs=; b=OvKZBtkSVIuhal8NQF+trarWxwmgq6Wiw/cbDYY8tMMfjZud9/5ATVMMxueNOwlHZGMuUI M29AcdqxQMrs9/5VIGuPJbYtA2lUavwVe3kcYb96TTYhR2vFbh4AFrCSy8VhIxR4O2mevj n07uNHkaE1+cYHhDSzY6jEsRuSliWxk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1741625986; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/15a4p4/MRhFHiV3UC/tU5arF9LRXK/RyuAoe1B54Zs=; b=yuCVoSsuVODwm2e/wNVO6b67HB9RlLPhbzlO3ATIFQBPElZ0sdOsDYG4LnVoHXS38M8rJP 8Fjj6sLzzb6BZBAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7CDC6139E7; Mon, 10 Mar 2025 16:59:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id o8dHHYIaz2fCaAAAD6G6ig (envelope-from ); Mon, 10 Mar 2025 16:59:46 +0000 From: Nicolai Stange To: "David S. Miller" , David Ahern Cc: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Stange Subject: [PATCH v1 4/4] ipv6: sr: continue initialization at ENOENT HMAC instantiation failures Date: Mon, 10 Mar 2025 17:58:57 +0100 Message-ID: <20250310165857.3584612-5-nstange@suse.de> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250310165857.3584612-1-nstange@suse.de> References: <20250310165857.3584612-1-nstange@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_SEVEN(0.00)[9]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 X-Spam-Flag: NO Content-Type: text/plain; charset="utf-8" As it currently stands, the IPv6 SR HMAC __init, and thus the IPv6 subsystem's __init, would fail to come up if any of the HMAC algo instantiations failed. This used to be fine, as they usually don't. However, that situation will change, because NIST announced to sunset SHA1 by 2030, and then at latest instantiations thereof through the cryptomgr will have to made to fail with -ENOENT when booted in FIPS mode. Note that the sunset date has implications on certificates' lifetimes for those issued today already, so distributions might be eager to disable SHA1 in FIPS mode downstream starting now. Make seg6_hmac_init_algos() to ignore ENOENT HMAC algo instantiation errors. Note that in this case, a failed algo will have its ->tfms =3D=3D N= ULL, and __hmac_get_algo() would filter such ones already. Signed-off-by: Nicolai Stange --- net/ipv6/seg6_hmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c index 85e90d8d8050..4a63ee4dbf7e 100644 --- a/net/ipv6/seg6_hmac.c +++ b/net/ipv6/seg6_hmac.c @@ -433,7 +433,7 @@ static int seg6_hmac_init_algos(void) alg_count =3D ARRAY_SIZE(hmac_algos); for (i =3D 0; i < alg_count; i++) { ret =3D seg6_hmac_init_algo(&hmac_algos[i]); - if (ret) + if (ret && ret !=3D -ENOENT) goto error_out; } =20 --=20 2.47.1