diff options
| author | Minhong He <heminhong@kylinos.cn> | 2025-08-15 14:38:45 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-08-28 16:21:37 +0200 |
| commit | 89dfc9280e828265832ab8c8f9cf0f15e1ce2603 (patch) | |
| tree | 2bab07ca6310ad38dc19043ec61fce01b6a5008a /net | |
| parent | 6cd6e75cf9cf19efedd8835de52dbfb6e47a8cfe (diff) | |
| download | linux-89dfc9280e828265832ab8c8f9cf0f15e1ce2603.tar.gz linux-89dfc9280e828265832ab8c8f9cf0f15e1ce2603.tar.bz2 linux-89dfc9280e828265832ab8c8f9cf0f15e1ce2603.zip | |
ipv6: sr: validate HMAC algorithm ID in seg6_hmac_info_add
[ 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 <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: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/ipv6/seg6_hmac.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c index b3b2aa92e60d..292a36576115 100644 --- a/net/ipv6/seg6_hmac.c +++ b/net/ipv6/seg6_hmac.c @@ -295,6 +295,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); |
