]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: fix iteration of extrefs during log replay
authorFilipe Manana <fdmanana@suse.com>
Mon, 23 Jun 2025 11:11:58 +0000 (12:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 13:59:47 +0000 (15:59 +0200)
commit539969fc472886a1d63565459514d47e27fef461
tree71ccbaac0854a42df8f848b9ceadcf27a26c2adb
parent5f1fa3934fa614cce3449f417ec79ca482b0a3ca
btrfs: fix iteration of extrefs during log replay

[ Upstream commit 54a7081ed168b72a8a2d6ef4ba3a1259705a2926 ]

At __inode_add_ref() when processing extrefs, if we jump into the next
label we have an undefined value of victim_name.len, since we haven't
initialized it before we did the goto. This results in an invalid memory
access in the next iteration of the loop since victim_name.len was not
initialized to the length of the name of the current extref.

Fix this by initializing victim_name.len with the current extref's name
length.

Fixes: e43eec81c516 ("btrfs: use struct qstr instead of name and namelen pairs")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/tree-log.c