lkml.org 
[lkml]   [2019]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2] btrfs: fix a NULL pointer dereference
From
Date


On 14.03.19 г. 10:13 ч., Kangjie Lu wrote:
> btrfs_lookup_block_group may fail and return NULL. The fix uses
> assert to ensure cache is not NULL.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

>
> ---
> V2: use assert as suggested by Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/extent-tree.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 994f0cc41799..80d7c272d282 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -7303,6 +7303,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
>
> pin = 0;
> cache = btrfs_lookup_block_group(fs_info, buf->start);
> + ASSERT(cache);
>
> if (btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) {
> pin_down_extent(fs_info, cache, buf->start,
>

\
 
 \ /
  Last update: 2019-03-14 09:17    [W:0.092 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site