mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 15:10:38 +00:00
[XFRM]: Fix possible overflow of sock->sk_policy
Spotted by, and original patch by, Balazs Scheidler. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cadf01c2fc
commit
a4f1bac625
@ -1350,6 +1350,9 @@ static struct xfrm_policy *xfrm_compile_policy(u16 family, int opt,
|
|||||||
if (nr > XFRM_MAX_DEPTH)
|
if (nr > XFRM_MAX_DEPTH)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (p->dir > XFRM_POLICY_OUT)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
xp = xfrm_policy_alloc(GFP_KERNEL);
|
xp = xfrm_policy_alloc(GFP_KERNEL);
|
||||||
if (xp == NULL) {
|
if (xp == NULL) {
|
||||||
*dir = -ENOBUFS;
|
*dir = -ENOBUFS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user