[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240624030720.137753-1-aha310510@gmail.com>
Date: Mon, 24 Jun 2024 12:07:20 +0900
From: Jeongjun Park <aha310510@...il.com>
To: clm@...com,
dsterba@...e.com,
josef@...icpanda.com
Cc: syzbot+a0d1f7e26910be4dc171@...kaller.appspotmail.com,
fdmanana@...e.com,
linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com,
Jeongjun Park <aha310510@...il.com>
Subject: [PATCH] btrfs: qgroup: fix slab-out-of-bounds in btrfs_qgroup_inherit
If a value exists in inherit->num_ref_copies or inherit->num_excl_copies,
an out-of-bounds vulnerability occurs.
Therefore, you need to add code to check the presence or absence of
that value.
Regards.
Jeongjun Park.
Reported-by: syzbot+a0d1f7e26910be4dc171@...kaller.appspotmail.com
Fixes: 3f5e2d3b3877 ("Btrfs: fix missing check in the btrfs_qgroup_inherit()")
Signed-off-by: Jeongjun Park <aha310510@...il.com>
---
fs/btrfs/qgroup.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/btrfs/qgroup.c b /fs/btrfs/qgroup.c
index fc2a7ea26354..23beac746637 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -3270,6 +3270,10 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid,
}
if (inherit) {
+ if (inherit->num_ref_copies > 0 || inherit->num_excl_copies > 0) {
+ ret = -EINVAL;
+ goto out;
+ }
i_qgroups = (u64 *)(inherit + 1);
nums = inherit->num_qgroups + 2 * inherit->num_ref_copies +
2 * inherit->num_excl_copies;
--
Powered by blists - more mailing lists