2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 11:44:01 +08:00

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: 3095e8e366 ("eCryptfs: Use skcipher and shash")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Herbert Xu 2016-03-16 17:06:01 +08:00
parent 34074205bb
commit d1558f4e95

View File

@ -635,8 +635,7 @@ ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes,
if (!s) { if (!s) {
printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc "
"[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); "[%zd] bytes of kernel memory\n", __func__, sizeof(*s));
rc = -ENOMEM; return -ENOMEM;
goto out;
} }
(*packet_size) = 0; (*packet_size) = 0;
rc = ecryptfs_find_auth_tok_for_sig( rc = ecryptfs_find_auth_tok_for_sig(
@ -922,8 +921,7 @@ ecryptfs_parse_tag_70_packet(char **filename, size_t *filename_size,
if (!s) { if (!s) {
printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc "
"[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); "[%zd] bytes of kernel memory\n", __func__, sizeof(*s));
rc = -ENOMEM; return -ENOMEM;
goto out;
} }
if (max_packet_size < ECRYPTFS_TAG_70_MIN_METADATA_SIZE) { if (max_packet_size < ECRYPTFS_TAG_70_MIN_METADATA_SIZE) {
printk(KERN_WARNING "%s: max_packet_size is [%zd]; it must be " printk(KERN_WARNING "%s: max_packet_size is [%zd]; it must be "