From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 24984308F03; Tue, 26 Aug 2025 13:13:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756214019; cv=none; b=hqbHdg7cnE4stRbKgWD6dJbEjHPCApTIxQ1KFn6qwfC/WKMv26l8QdgjpiEfhBBj+9/ZpWNIttjJqBS3JrIcj+0/NvLMBkN4tOpQ2G6NOEnIn4Y6hkh3RyI8WB7cNGc9xdNsxBMTIm0PhnujjNtxq+pyjZ2I8ideJkENm/+8qac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756214019; c=relaxed/simple; bh=J5+11ova6e1cQv+jK+gQc1vyVhb0ymFNisywv00nUv8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pgGTcEXGNiTwmvY+hzhjUeOG1464gIUsWo84v85qZM2koRBa5jHSkp3gtNYJ3eCmcYZ+9kINt9CFrUKmAg5a05ZOQH3rxBhcT0OMACfJJqcgxW4yPiiqzzNbF0+EidqfllH0V2IXUCb6bUp24lfQov/R07S9w0dyapdKy15eXR8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ai0CMJNo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Ai0CMJNo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56FDBC4CEF1; Tue, 26 Aug 2025 13:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756214018; bh=J5+11ova6e1cQv+jK+gQc1vyVhb0ymFNisywv00nUv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ai0CMJNohfrHZy8rtbcC3q514o76+1TG+dSY0QmLlac98dIhnSat6/8O8G654DskN Cb+xXDdvq3AGBvMGjsF9NO3REfSOhFe280WH7YqZYd9F7tiGLHws3Z0ilbckfVpAfM Rgpumd6Jv7tv0DO2svTVuZfp4KjbLJSGtwOytdxU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Minhong He , Kuniyuki Iwashima , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 566/587] ipv6: sr: validate HMAC algorithm ID in seg6_hmac_info_add Date: Tue, 26 Aug 2025 13:11:55 +0200 Message-ID: <20250826111007.427604566@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110952.942403671@linuxfoundation.org> References: <20250826110952.942403671@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Minhong He [ Upstream commit 84967deee9d9870b15bc4c3acb50f1d401807902 ] The seg6_genl_sethmac() directly uses the algorithm ID provided by the userspace without verifying whether it is an HMAC algorithm supported by the system. If an unsupported HMAC algorithm ID is configured, packets using SRv6 HMAC will be dropped during encapsulation or decapsulation. Fixes: 4f4853dc1c9c ("ipv6: sr: implement API to control SR HMAC structure") Signed-off-by: Minhong He Reviewed-by: Kuniyuki Iwashima Link: https://patch.msgid.link/20250815063845.85426-1-heminhong@kylinos.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv6/seg6_hmac.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c index 22a5006ad34a..6e15a65faecc 100644 --- a/net/ipv6/seg6_hmac.c +++ b/net/ipv6/seg6_hmac.c @@ -294,6 +294,9 @@ int seg6_hmac_info_add(struct net *net, u32 key, struct seg6_hmac_info *hinfo) struct seg6_pernet_data *sdata = seg6_pernet(net); int err; + if (!__hmac_get_algo(hinfo->alg_id)) + return -EINVAL; + err = rhashtable_lookup_insert_fast(&sdata->hmac_infos, &hinfo->node, rht_params); -- 2.50.1