[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200820091614.771086747@linuxfoundation.org>
Date: Thu, 20 Aug 2020 11:18:12 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Nikolay Borisov <nborisov@...e.com>,
Qu Wenruo <wqu@...e.com>, Boleyn Su <boleynsu@...gle.com>,
David Sterba <dsterba@...e.com>
Subject: [PATCH 5.8 041/232] btrfs: check correct variable after allocation in btrfs_backref_iter_alloc
From: Boleyn Su <boleynsu@...gle.com>
commit c15c2ec07a26b251040943a1a9f90d3037f041e5 upstream.
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: stable@...r.kernel.org # 5.8+
Reviewed-by: Nikolay Borisov <nborisov@...e.com>
Reviewed-by: Qu Wenruo <wqu@...e.com>
Signed-off-by: Boleyn Su <boleynsu@...gle.com>
Reviewed-by: David Sterba <dsterba@...e.com>
Signed-off-by: David Sterba <dsterba@...e.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/btrfs/backref.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -2303,7 +2303,7 @@ struct btrfs_backref_iter *btrfs_backref
return NULL;
ret->path = btrfs_alloc_path();
- if (!ret) {
+ if (!ret->path) {
kfree(ret);
return NULL;
}
Powered by blists - more mailing lists