xfrm: Use GFP_ATOMIC in xfrm_compile_policy
authorHerbert Xu <herbert@gondor.apana.org.au>
Sun, 15 Aug 2010 05:38:09 +0000 (22:38 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 15 Aug 2010 05:38:09 +0000 (22:38 -0700)
As xfrm_compile_policy runs within a read_lock, we cannot use
GFP_KERNEL for memory allocations.

Reported-by: Luca Tettamanti <kronos.it@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/xfrm/xfrm_user.c

index ba59983aaffee6e3d7f7a0afb241f92d787b152d..b14ed4b1f27c3bd70f5837c2f032baf11a88e9a1 100644 (file)
@@ -2504,7 +2504,7 @@ static struct xfrm_policy *xfrm_compile_policy(struct sock *sk, int opt,
        if (p->dir > XFRM_POLICY_OUT)
                return NULL;
 
-       xp = xfrm_policy_alloc(net, GFP_KERNEL);
+       xp = xfrm_policy_alloc(net, GFP_ATOMIC);
        if (xp == NULL) {
                *dir = -ENOBUFS;
                return NULL;