Skip to content

Commit c15c2ec

Browse files
BoleynSukdave
authored andcommitted
btrfs: check correct variable after allocation in btrfs_backref_iter_alloc
The `if (!ret)` check will always be false and it may result in ret->path being dereferenced while it is a NULL pointer. Fixes: a37f232 ("btrfs: backref: introduce the skeleton of btrfs_backref_iter") CC: [email protected] # 5.8+ Reviewed-by: Nikolay Borisov <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Boleyn Su <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent faa0088 commit c15c2ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/backref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2303,7 +2303,7 @@ struct btrfs_backref_iter *btrfs_backref_iter_alloc(
23032303
return NULL;
23042304

23052305
ret->path = btrfs_alloc_path();
2306-
if (!ret) {
2306+
if (!ret->path) {
23072307
kfree(ret);
23082308
return NULL;
23092309
}

0 commit comments

Comments
 (0)