ext4: return -ENOMEM instead of success
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 10 Dec 2016 14:56:01 +0000 (09:56 -0500)
committerSasha Levin <alexander.levin@verizon.com>
Fri, 13 Jan 2017 01:56:57 +0000 (20:56 -0500)
[ Upstream commit 578620f451f836389424833f1454eeeb2ffc9e9f ]

We should set the error code if kzalloc() fails.

Fixes: 67cf5b09a46f ("ext4: add the basic function for inline data support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
fs/ext4/inline.c

index 095c7a258d97d0bf05b26de9bf42c99fc01b143d..d77d542c2ed50d139621656d97c2480544e5aade 100644 (file)
@@ -336,8 +336,10 @@ static int ext4_update_inline_data(handle_t *handle, struct inode *inode,
 
        len -= EXT4_MIN_INLINE_DATA_SIZE;
        value = kzalloc(len, GFP_NOFS);
-       if (!value)
+       if (!value) {
+               error = -ENOMEM;
                goto out;
+       }
 
        error = ext4_xattr_ibody_get(inode, i.name_index, i.name,
                                     value, len);