Skip to content

Commit dcd40a7

Browse files
suchit07-gitfdmanana
authored andcommitted
btrfs: fix NULL pointer dereference in do_abort_log_replay()
Coverity reported a NULL pointer dereference issue (CID 1666756) in do_abort_log_replay(). When btrfs_alloc_path() fails in replay_one_buffer(), wc->subvol_path is NULL, but btrfs_abort_log_replay() calls do_abort_log_replay() which unconditionally dereferences wc->subvol_path when attempting to print debug information. Fix this by adding a NULL check before dereferencing wc->subvol_path in do_abort_log_replay(). Reviewed-by: Filipe Manana <fdmanana@suse.com> Fixes: 2753e49 ("btrfs: dump detailed info and specific messages on log replay failures") Signed-off-by: Suchit Karunakaran <suchitkarunakaran@gmail.com> Signed-off-by: Filipe Manana <fdmanana@suse.com>
1 parent fdba66e commit dcd40a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/tree-log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static void do_abort_log_replay(struct walk_control *wc, const char *function,
190190

191191
btrfs_abort_transaction(wc->trans, error);
192192

193-
if (wc->subvol_path->nodes[0]) {
193+
if (wc->subvol_path && wc->subvol_path->nodes[0]) {
194194
btrfs_crit(fs_info,
195195
"subvolume (root %llu) leaf currently being processed:",
196196
btrfs_root_id(wc->root));

0 commit comments

Comments
 (0)