diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2016-03-16 05:06:01 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-03-17 07:09:00 -0400 |
commit | d1558f4e95cb14b0fff5c0b839c15a21f7e8aed0 (patch) | |
tree | d214356cb58f5bc51c210b45244bcf7dbab6f7e0 | |
parent | 34074205bb9f04b416efb3cbedcd90f418c86200 (diff) |
eCryptfs: Use skcipher and shash
eCryptfs: Fix null pointer dereference on kzalloc error path
The conversion to skcipher and shash added a couple of null pointer
dereference bugs on the kzalloc failure path. This patch fixes them.
Fixes: 3095e8e366b4 ("eCryptfs: Use skcipher and shash")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | fs/ecryptfs/keystore.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index c5c84dfb5b3e..9893d1538122 100644 --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c | |||
@@ -635,8 +635,7 @@ ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes, | |||
635 | if (!s) { | 635 | if (!s) { |
636 | printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " | 636 | printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " |
637 | "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); | 637 | "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); |
638 | rc = -ENOMEM; | 638 | return -ENOMEM; |
639 | goto out; | ||
640 | } | 639 | } |
641 | (*packet_size) = 0; | 640 | (*packet_size) = 0; |
642 | rc = ecryptfs_find_auth_tok_for_sig( | 641 | rc = ecryptfs_find_auth_tok_for_sig( |
@@ -922,8 +921,7 @@ ecryptfs_parse_tag_70_packet(char **filename, size_t *filename_size, | |||
922 | if (!s) { | 921 | if (!s) { |
923 | printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " | 922 | printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " |
924 | "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); | 923 | "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); |
925 | rc = -ENOMEM; | 924 | return -ENOMEM; |
926 | goto out; | ||
927 | } | 925 | } |
928 | if (max_packet_size < ECRYPTFS_TAG_70_MIN_METADATA_SIZE) { | 926 | if (max_packet_size < ECRYPTFS_TAG_70_MIN_METADATA_SIZE) { |
929 | printk(KERN_WARNING "%s: max_packet_size is [%zd]; it must be " | 927 | printk(KERN_WARNING "%s: max_packet_size is [%zd]; it must be " |