Patch "ext4: use kmemdup() to replace kmalloc + memcpy" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ext4: use kmemdup() to replace kmalloc + memcpy

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ext4-use-kmemdup-to-replace-kmalloc-memcpy.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 9cac30ee5a4959e6ae031feaae25067c8d24b31a
Author: Shuqi Zhang <zhangshuqi3@xxxxxxxxxx>
Date:   Wed May 25 11:01:20 2022 +0800

    ext4: use kmemdup() to replace kmalloc + memcpy
    
    [ Upstream commit 4efd9f0d120c55b08852ee5605dbb02a77089a5d ]
    
    Replace kmalloc + memcpy with kmemdup()
    
    Signed-off-by: Shuqi Zhang <zhangshuqi3@xxxxxxxxxx>
    Reviewed-by: Ritesh Harjani <ritesh.list@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20220525030120.803330-1-zhangshuqi3@xxxxxxxxxx
    Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
    Stable-dep-of: a44e84a9b776 ("ext4: fix deadlock due to mbcache entry corruption")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 7195a7ff65a6..959fc3328c3a 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1911,11 +1911,10 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
 
 			unlock_buffer(bs->bh);
 			ea_bdebug(bs->bh, "cloning");
-			s->base = kmalloc(bs->bh->b_size, GFP_NOFS);
+			s->base = kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS);
 			error = -ENOMEM;
 			if (s->base == NULL)
 				goto cleanup;
-			memcpy(s->base, BHDR(bs->bh), bs->bh->b_size);
 			s->first = ENTRY(header(s->base)+1);
 			header(s->base)->h_refcount = cpu_to_le32(1);
 			s->here = ENTRY(s->base + offset);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux