Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1558f4e authored by Herbert Xu's avatar Herbert Xu
Browse files

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: 3095e8e3 ("eCryptfs: Use skcipher and shash")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 34074205
Loading
Loading
Loading
Loading
+2 −4
Original line number Original line Diff line number Diff line
@@ -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 "