summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorLin Ma <linma@zju.edu.cn>2023-06-27 06:39:54 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-23 18:52:32 +0300
commit479884b4ce16ea6a4cc5a4392f8d778616db9e26 (patch)
tree997e87e81bacb0eeb4cffd9fb459667c530b1418 /net
parent9a0056276f5f38e188732bd7b6949edca6a80ea1 (diff)
downloadlinux-479884b4ce16ea6a4cc5a4392f8d778616db9e26.tar.xz
net: af_key: fix sadb_x_filter validation
[ Upstream commit 75065a8929069bc93181848818e23f147a73f83a ] When running xfrm_state_walk_init(), the xfrm_address_filter being used is okay to have a splen/dplen that equals to sizeof(xfrm_address_t)<<3. This commit replaces >= to > to make sure the boundary checking is correct. Fixes: 37bd22420f85 ("af_key: pfkey_dump needs parameter validation") Signed-off-by: Lin Ma <linma@zju.edu.cn> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/key/af_key.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 8c21de50eadf..8a8f2429d5d9 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1848,9 +1848,9 @@ static int pfkey_dump(struct sock *sk, struct sk_buff *skb, const struct sadb_ms
if (ext_hdrs[SADB_X_EXT_FILTER - 1]) {
struct sadb_x_filter *xfilter = ext_hdrs[SADB_X_EXT_FILTER - 1];
- if ((xfilter->sadb_x_filter_splen >=
+ if ((xfilter->sadb_x_filter_splen >
(sizeof(xfrm_address_t) << 3)) ||
- (xfilter->sadb_x_filter_dplen >=
+ (xfilter->sadb_x_filter_dplen >
(sizeof(xfrm_address_t) << 3))) {
mutex_unlock(&pfk->dump_lock);
return -EINVAL;