[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241025022348.1255662-1-lizhi.xu@windriver.com>
Date: Fri, 25 Oct 2024 10:23:48 +0800
From: Lizhi Xu <lizhi.xu@...driver.com>
To: <syzbot+3030e17bd57a73d39bd7@...kaller.appspotmail.com>
CC: <clm@...com>, <dsterba@...e.com>, <josef@...icpanda.com>,
<linux-btrfs@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<syzkaller-bugs@...glegroups.com>
Subject: Re: [syzbot] [btrfs?] general protection fault in btrfs_search_slot
use the input logical can't find the extent root, so add sanity check for
extent root before search slot.
#syz test
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index f8e1d5b2c512..87eaf5dd2d5d 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -2213,6 +2213,9 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
key.objectid = logical;
key.offset = (u64)-1;
+ if (!extent_root)
+ return -ENOENT;
+
ret = btrfs_search_slot(NULL, extent_root, &key, path, 0, 0);
if (ret < 0)
return ret;
Powered by blists - more mailing lists