Skip to content

Commit 75065a8

Browse files
f0rm2l1nklassert
authored andcommitted
net: af_key: fix sadb_x_filter validation
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 <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent dfa73c1 commit 75065a8

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
@@ -1848,9 +1848,9 @@ static int pfkey_dump(struct sock *sk, struct sk_buff *skb, const struct sadb_ms
18481848
if (ext_hdrs[SADB_X_EXT_FILTER - 1]) {
18491849
struct sadb_x_filter *xfilter = ext_hdrs[SADB_X_EXT_FILTER - 1];
18501850

1851-
if ((xfilter->sadb_x_filter_splen >=
1851+
if ((xfilter->sadb_x_filter_splen >
18521852
(sizeof(xfrm_address_t) << 3)) ||
1853-
(xfilter->sadb_x_filter_dplen >=
1853+
(xfilter->sadb_x_filter_dplen >
18541854
(sizeof(xfrm_address_t) << 3))) {
18551855
mutex_unlock(&pfk->dump_lock);
18561856
return -EINVAL;

0 commit comments

Comments
 (0)