]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
IPCOMP: Disable BH on output when using shared tfm
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 6 Mar 2008 04:07:37 +0000 (20:07 -0800)
committerChris Wright <chrisw@sous-sol.org>
Mon, 24 Mar 2008 18:47:08 +0000 (11:47 -0700)
Upstream commit: 21e43188f272c7fd9efc84b8244c0b1dfccaa105

Because we use shared tfm objects in order to conserve memory,
(each tfm requires 128K of vmalloc memory), BH needs to be turned
off on output as that can occur in process context.

Previously this was done implicitly by the xfrm output code.
That was lost when it became lockless.  So we need to add the
BH disabling to IPComp directly.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
net/ipv4/ipcomp.c
net/ipv6/ipcomp6.c

index 80cab8c73074525026c514633b415e9d36d76a98..b284b4ee15071a21f6f679f80d689ae538fb69cc 100644 (file)
@@ -108,8 +108,11 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb)
        const int cpu = get_cpu();
        u8 *scratch = *per_cpu_ptr(ipcomp_scratches, cpu);
        struct crypto_comp *tfm = *per_cpu_ptr(ipcd->tfms, cpu);
-       int err = crypto_comp_compress(tfm, start, plen, scratch, &dlen);
+       int err;
 
+       local_bh_disable();
+       err = crypto_comp_compress(tfm, start, plen, scratch, &dlen);
+       local_bh_enable();
        if (err)
                goto out;
 
index 1c5b09f44a752eb015854e1e9b14b9f9b51ce3dc..f46c38fed09dcd8f4475192a7f6702642f65130b 100644 (file)
@@ -146,7 +146,9 @@ static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb)
        scratch = *per_cpu_ptr(ipcomp6_scratches, cpu);
        tfm = *per_cpu_ptr(ipcd->tfms, cpu);
 
+       local_bh_disable();
        err = crypto_comp_compress(tfm, start, plen, scratch, &dlen);
+       local_bh_enable();
        if (err || (dlen + sizeof(*ipch)) >= plen) {
                put_cpu();
                goto out_ok;