Skip to content

Commit 579849f

Browse files
author
CKI Backport Bot
committed
ipv6: sr: validate HMAC algorithm ID in seg6_hmac_info_add
JIRA: https://issues.redhat.com/browse/RHEL-115599 commit 84967de Author: Minhong He <heminhong@kylinos.cn> Date: Fri Aug 15 14:38:45 2025 +0800 ipv6: sr: validate HMAC algorithm ID in seg6_hmac_info_add 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: 4f4853d ("ipv6: sr: implement API to control SR HMAC structure") Signed-off-by: Minhong He <heminhong@kylinos.cn> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20250815063845.85426-1-heminhong@kylinos.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com>
1 parent 11a20dc commit 579849f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/ipv6/seg6_hmac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ int seg6_hmac_info_add(struct net *net, u32 key, struct seg6_hmac_info *hinfo)
295295
struct seg6_pernet_data *sdata = seg6_pernet(net);
296296
int err;
297297

298+
if (!__hmac_get_algo(hinfo->alg_id))
299+
return -EINVAL;
300+
298301
err = rhashtable_lookup_insert_fast(&sdata->hmac_infos, &hinfo->node,
299302
rht_params);
300303

0 commit comments

Comments
 (0)