diff options
author | Boleyn Su <[email protected]> | 2020-08-06 15:31:44 +0900 |
---|---|---|
committer | David Sterba <[email protected]> | 2020-08-10 19:50:54 +0200 |
commit | c15c2ec07a26b251040943a1a9f90d3037f041e5 (patch) | |
tree | 237dad00fd4bc1bc0ae6d226cfec559da6dc7531 | |
parent | faa008899a4db21a2df99833cb4ff6fa67009a20 (diff) |
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: a37f232b7b65 ("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]>
-rw-r--r-- | fs/btrfs/backref.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index ea10f7bc99ab..ea1c28ccb44f 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -2303,7 +2303,7 @@ struct btrfs_backref_iter *btrfs_backref_iter_alloc( return NULL; ret->path = btrfs_alloc_path(); - if (!ret) { + if (!ret->path) { kfree(ret); return NULL; } |