Skip to content

Commit 32cc777

Browse files
f0rm2l1ngregkh
authored andcommitted
net: af_key: fix sadb_x_filter validation
[ Upstream commit 75065a8 ] 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: 37bd224 ("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>
1 parent 373848d commit 32cc777

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/key/af_key.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,9 +1852,9 @@ static int pfkey_dump(struct sock *sk, struct sk_buff *skb, const struct sadb_ms
18521852
if (ext_hdrs[SADB_X_EXT_FILTER - 1]) {
18531853
struct sadb_x_filter *xfilter = ext_hdrs[SADB_X_EXT_FILTER - 1];
18541854

1855-
if ((xfilter->sadb_x_filter_splen >=
1855+
if ((xfilter->sadb_x_filter_splen >
18561856
(sizeof(xfrm_address_t) << 3)) ||
1857-
(xfilter->sadb_x_filter_dplen >=
1857+
(xfilter->sadb_x_filter_dplen >
18581858
(sizeof(xfrm_address_t) << 3))) {
18591859
mutex_unlock(&pfk->dump_lock);
18601860
return -EINVAL;

0 commit comments

Comments
 (0)