diff options
-rw-r--r-- | crypto/lzo.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/crypto/lzo.c b/crypto/lzo.c index 1c2aa69c54b8..252e791d0ccc 100644 --- a/crypto/lzo.c +++ b/crypto/lzo.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/crypto.h> | 21 | #include <linux/crypto.h> |
22 | #include <linux/vmalloc.h> | 22 | #include <linux/vmalloc.h> |
23 | #include <linux/mm.h> | ||
23 | #include <linux/lzo.h> | 24 | #include <linux/lzo.h> |
24 | 25 | ||
25 | struct lzo_ctx { | 26 | struct lzo_ctx { |
@@ -30,7 +31,10 @@ static int lzo_init(struct crypto_tfm *tfm) | |||
30 | { | 31 | { |
31 | struct lzo_ctx *ctx = crypto_tfm_ctx(tfm); | 32 | struct lzo_ctx *ctx = crypto_tfm_ctx(tfm); |
32 | 33 | ||
33 | ctx->lzo_comp_mem = vmalloc(LZO1X_MEM_COMPRESS); | 34 | ctx->lzo_comp_mem = kmalloc(LZO1X_MEM_COMPRESS, |
35 | GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); | ||
36 | if (!ctx->lzo_comp_mem) | ||
37 | ctx->lzo_comp_mem = vmalloc(LZO1X_MEM_COMPRESS); | ||
34 | if (!ctx->lzo_comp_mem) | 38 | if (!ctx->lzo_comp_mem) |
35 | return -ENOMEM; | 39 | return -ENOMEM; |
36 | 40 | ||
@@ -41,7 +45,10 @@ static void lzo_exit(struct crypto_tfm *tfm) | |||
41 | { | 45 | { |
42 | struct lzo_ctx *ctx = crypto_tfm_ctx(tfm); | 46 | struct lzo_ctx *ctx = crypto_tfm_ctx(tfm); |
43 | 47 | ||
44 | vfree(ctx->lzo_comp_mem); | 48 | if (is_vmalloc_addr(ctx->lzo_comp_mem)) |
49 | vfree(ctx->lzo_comp_mem); | ||
50 | else | ||
51 | kfree(ctx->lzo_comp_mem); | ||
45 | } | 52 | } |
46 | 53 | ||
47 | static int lzo_compress(struct crypto_tfm *tfm, const u8 *src, | 54 | static int lzo_compress(struct crypto_tfm *tfm, const u8 *src, |