From: Herbert Xu Date: Tue, 26 Jul 2005 22:43:17 +0000 (-0700) Subject: [XFRM]: Fix possible overflow of sock->sk_policy X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a4f1bac62564049ea4718c4624b0fadc9f597c84;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [XFRM]: Fix possible overflow of sock->sk_policy Spotted by, and original patch by, Balazs Scheidler. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index ecade4893a13..8da3e25b2c4c 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -1350,6 +1350,9 @@ static struct xfrm_policy *xfrm_compile_policy(u16 family, int opt, if (nr > XFRM_MAX_DEPTH) return NULL; + if (p->dir > XFRM_POLICY_OUT) + return NULL; + xp = xfrm_policy_alloc(GFP_KERNEL); if (xp == NULL) { *dir = -ENOBUFS;