From: syzbot <syzbot+eadd98df8bceb15d7fed@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Forwarded: [PATCH] memory leak in btrfs_read_chunk_tree
Date: Wed, 10 Dec 2025 02:05:20 -0800 [thread overview]
Message-ID: <693945e0.050a0220.4004e.00e1.GAE@google.com> (raw)
In-Reply-To: <69369331.a70a0220.38f243.009e.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH] memory leak in btrfs_read_chunk_tree
Author: hariconscious@gmail.com
#syz test
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ae1742a35e76..fa912137c94d 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -7188,6 +7188,8 @@ static int read_one_dev(struct extent_buffer *leaf,
if (!btrfs_test_opt(fs_info, DEGRADED)) {
btrfs_report_missing_device(fs_info, devid,
dev_uuid, true);
+ //1
+ free_fs_devices(fs_devices);
return -ENOENT;
}
@@ -7196,6 +7198,8 @@ static int read_one_dev(struct extent_buffer *leaf,
btrfs_err(fs_info,
"failed to add missing dev %llu: %ld",
devid, PTR_ERR(device));
+ //2
+ free_fs_devices(fs_devices);
return PTR_ERR(device);
}
btrfs_report_missing_device(fs_info, devid, dev_uuid,
false);
@@ -7204,6 +7208,8 @@ static int read_one_dev(struct extent_buffer *leaf,
if (!btrfs_test_opt(fs_info, DEGRADED)) {
btrfs_report_missing_device(fs_info,
devid, dev_uuid, true);
+ //3
+ free_fs_devices(fs_devices);
return -ENOENT;
}
btrfs_report_missing_device(fs_info, devid,
@@ -7242,6 +7248,9 @@ static int read_one_dev(struct extent_buffer *leaf,
BUG_ON(test_bit(BTRFS_DEV_STATE_WRITEABLE,
&device->dev_state));
if (device->generation !=
btrfs_device_generation(leaf, dev_item))
+ //4
+ btrfs_free_device(device);
+ free_fs_devices(fs_devices);
return -EINVAL;
}
@@ -7253,6 +7262,9 @@ static int read_one_dev(struct extent_buffer *leaf,
btrfs_err(fs_info,
"device total_bytes should be at most %llu but
found %llu",
max_total_bytes, device->total_bytes);
+ //5
+ btrfs_free_device(device);
+ free_fs_devices(fs_devices);
return -EINVAL;
}
}
next prev parent reply other threads:[~2025-12-10 10:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 8:58 [syzbot] [btrfs?] memory leak in btrfs_read_chunk_tree syzbot
2025-12-09 16:53 ` Forwarded: [PATCH] " syzbot
2025-12-09 16:59 ` syzbot
2025-12-10 10:05 ` syzbot [this message]
2025-12-10 13:00 ` Forwarded: [PATCH] btrfs: fix memory leak of fs_devices in degraded seed device path syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=693945e0.050a0220.4004e.00e1.GAE@google.com \
--to=syzbot+eadd98df8bceb15d7fed@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.