From nobody Mon Dec 15 00:34:36 2025 Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81902202963 for ; Wed, 10 Dec 2025 10:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765361123; cv=none; b=G1TNEkKFlebI3itabNyfYpmRRheo1hZZ3HTcAPARlBQwfOSrxt9qVASXSwXBMvZYLIjF58qUEE+rac+tWeMw67dDPdRguaTSzSM2lC+hSxccn7WSHXDWKD3QQbNZnRMvGh2aYB6kQy7GmYJsd675R60Syda3/P5pmWqqBVzfKMs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765361123; c=relaxed/simple; bh=uzSp6N4b/IwWTRyQGqVe/RThMv9Yk7OAbh0kGsDibN8=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=qRYZzZIBa+QoOoComZeEGs183wlNLO2Gqjum+xOMcGPxom5BxuzI3Iv64iilL6U38ztX583zvSzyA7mtJiUDGMk0iW5A+Q5+MjDmKvwFmWecRnQkYiiDQZgXvg3tMFgHzHI2UGk4WiHHbLsmu3uv6MGakqvCFNmsovTPfjSTLTc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.167.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oi1-f200.google.com with SMTP id 5614622812f47-450fd003480so9183022b6e.2 for ; Wed, 10 Dec 2025 02:05:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765361120; x=1765965920; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=W6aVqRVqGmhQuj4m9Rq4VS9wz3JJjgzTobVCLBiXGhk=; b=vVt+ZIq17uB5Um4gUceg0ieiF0TUiNWem9JEOfocgU3VvsE75jJ8QFHJ5hqMtpVWuO Lx1uZrs1K4HV2KLhFGNZ930fW+2ysPxQ2XT77m4LfhEPi9dMxGMQ0NUNG9N1jst3K4ET 5b6f5AQpv44PUH/JEGbZbIUutT3+1eKJNGYBAlAJfrhoX8QZfdjYxlRPstOg6+rMD1/0 zV8DauuR+ooDoWzzah2smqtTPqi93Ll2oOwIcQVKVcjttB35aapxqeJ7ANb59M8wqApe XFsTNQGixJ59WR+5vmSGE+rvPWFB+2bXUj6uOSeU1Me4abNpQTdx+sSSKRjusVR2Z8G2 nnzA== X-Gm-Message-State: AOJu0YxR7vfXAJIN6Vzb5yBgdL6lHbhYpuovIJoaA/Xm1dJ/L4RpV7aA g7H9FvYXXGZTdP/8ceBS6fCNQzQiY/t7emDZnl+irWfgKkmlxe3db2UgjMNqHnD/16czm3Gu8J9 AbRuvl2qJtHgtGdB7JEz32yhSuCOA5dAsbYjBe4+CHzAcSjLHQAGZM+be1e4= X-Google-Smtp-Source: AGHT+IFEo2tnZrs/Wk8//vzqFEdLSm6rVTZ8Lw2PDkOIiWGJd0oBW5gHW5m2z95oyqPzty7XQwv3TtNJrAnv+djloiyyFZHqDmeg Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a4a:e909:0:b0:659:9a49:9080 with SMTP id 006d021491bc7-65b2ad3a38bmr1241177eaf.75.1765361120530; Wed, 10 Dec 2025 02:05:20 -0800 (PST) Date: Wed, 10 Dec 2025 02:05:20 -0800 In-Reply-To: <69369331.a70a0220.38f243.009e.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <693945e0.050a0220.4004e.00e1.GAE@google.com> Subject: Forwarded: [PATCH] memory leak in btrfs_read_chunk_tree From: syzbot To: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 !=3D 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; } }