add patch fix-sleep-in-atomic-context-in-grab_mapping_entry
[ext4-patch-queue.git] / return-enomem-instead-of-success
blob22be0a923fcde5cd71c043aad466189e85ef202d
1 ext4: return -ENOMEM instead of success
3 From: Dan Carpenter <dan.carpenter@oracle.com>
5 We should set the error code if kzalloc() fails.
7 Fixes: 67cf5b09a46f ("ext4: add the basic function for inline data support")
8 Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
9 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 Cc: stable@vger.kernel.org
11 ---
12 diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
13 index 9b67f75bdcf7..437df6a1a841 100644
14 --- a/fs/ext4/inline.c
15 +++ b/fs/ext4/inline.c
16 @@ -341,8 +341,10 @@ static int ext4_update_inline_data(handle_t *handle, struct inode *inode,
18         len -= EXT4_MIN_INLINE_DATA_SIZE;
19         value = kzalloc(len, GFP_NOFS);
20 -       if (!value)
21 +       if (!value) {
22 +               error = -ENOMEM;
23                 goto out;
24 +       }
26         error = ext4_xattr_ibody_get(inode, i.name_index, i.name,
27                                      value, len);