mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
btrfs: fix uninitialized pointer free on read_alloc_one_name() error
commit 2ab5e243c2266c841e0f6904fad1514b18eaf510 upstream. The function read_alloc_one_name() does not initialize the name field of the passed fscrypt_str struct if kmalloc fails to allocate the corresponding buffer. Thus, it is not guaranteed that fscrypt_str.name is initialized when freeing it. This is a follow-up to the linked patch that fixes the remaining instances of the bug introduced by commite43eec81c5
("btrfs: use struct qstr instead of name and namelen pairs"). Link: https://lore.kernel.org/linux-btrfs/20241009080833.1355894-1-jroi.martin@gmail.com/ Fixes:e43eec81c5
("btrfs: use struct qstr instead of name and namelen pairs") CC: stable@vger.kernel.org # 6.1+ Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Roi Martin <jroi.martin@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e11ce03b58
commit
7fc7c47b9b
1 changed files with 2 additions and 2 deletions
|
@ -1846,7 +1846,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_dir_item *di,
|
struct btrfs_dir_item *di,
|
||||||
struct btrfs_key *key)
|
struct btrfs_key *key)
|
||||||
{
|
{
|
||||||
struct fscrypt_str name;
|
struct fscrypt_str name = { 0 };
|
||||||
struct btrfs_dir_item *dir_dst_di;
|
struct btrfs_dir_item *dir_dst_di;
|
||||||
struct btrfs_dir_item *index_dst_di;
|
struct btrfs_dir_item *index_dst_di;
|
||||||
bool dir_dst_matches = false;
|
bool dir_dst_matches = false;
|
||||||
|
@ -2126,7 +2126,7 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans,
|
||||||
struct extent_buffer *eb;
|
struct extent_buffer *eb;
|
||||||
int slot;
|
int slot;
|
||||||
struct btrfs_dir_item *di;
|
struct btrfs_dir_item *di;
|
||||||
struct fscrypt_str name;
|
struct fscrypt_str name = { 0 };
|
||||||
struct inode *inode = NULL;
|
struct inode *inode = NULL;
|
||||||
struct btrfs_key location;
|
struct btrfs_key location;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue