public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: qgroup: add missing extent changeset release
@ 2024-08-27 15:12 Fedor Pchelkin
  2024-08-27 16:03 ` David Sterba
  2024-08-28  9:24 ` Qu Wenruo
  0 siblings, 2 replies; 9+ messages in thread
From: Fedor Pchelkin @ 2024-08-27 15:12 UTC (permalink / raw)
  To: David Sterba
  Cc: Fedor Pchelkin, Chris Mason, Josef Bacik, Boris Burkov,
	linux-btrfs, linux-kernel, lvc-project,
	syzbot+81670362c283f3dd889c, stable

The extent changeset may have some additional memory dynamically allocated
for ulist in result of clear_record_extent_bits() execution.

Release it after the local changeset is no longer needed in
BTRFS_QGROUP_MODE_DISABLED case.

Found by Linux Verification Center (linuxtesting.org) with Syzkaller.

Reported-by: syzbot+81670362c283f3dd889c@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/lkml/000000000000aa8c0c060ade165e@google.com
Fixes: af0e2aab3b70 ("btrfs: qgroup: flush reservations during quota disable")
Cc: stable@vger.kernel.org # 6.10+
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
---
 fs/btrfs/qgroup.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 5d57a285d59b..4f1fa5d427e1 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -4345,9 +4345,10 @@ static int __btrfs_qgroup_release_data(struct btrfs_inode *inode,
 
 	if (btrfs_qgroup_mode(inode->root->fs_info) == BTRFS_QGROUP_MODE_DISABLED) {
 		extent_changeset_init(&changeset);
-		return clear_record_extent_bits(&inode->io_tree, start,
-						start + len - 1,
-						EXTENT_QGROUP_RESERVED, &changeset);
+		ret = clear_record_extent_bits(&inode->io_tree, start,
+					       start + len - 1,
+					       EXTENT_QGROUP_RESERVED, &changeset);
+		goto out;
 	}
 
 	/* In release case, we shouldn't have @reserved */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-08-28 21:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27 15:12 [PATCH] btrfs: qgroup: add missing extent changeset release Fedor Pchelkin
2024-08-27 16:03 ` David Sterba
2024-08-28  9:19   ` Fedor Pchelkin
2024-08-28  9:24 ` Qu Wenruo
2024-08-28  9:30   ` Qu Wenruo
2024-08-28 16:14     ` [PATCH v2] btrfs: qgroup: don't use extent changeset when not needed Fedor Pchelkin
2024-08-28 16:57       ` Boris Burkov
2024-08-28 21:36       ` Qu Wenruo
2024-08-28 21:56       ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox