From: Herbert Xu Date: Tue, 26 Jul 2005 23:40:31 +0000 (-0700) Subject: [PATCH] Fix possible overflow of sock->sk_policy X-Git-Tag: v2.6.12.4~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7cd6bfe6c56856eecb79a8cfd3d60599a8b280f;p=thirdparty%2Fkernel%2Fstable.git [PATCH] Fix possible overflow of sock->sk_policy [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 Signed-off-by: Chris Wright Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 97509011c274c..aff9a80f72c80 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -1180,6 +1180,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;