From nobody Sat Feb 7 20:39:46 2026 Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) (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 33F5A318ECC for ; Fri, 9 Jan 2026 08:43:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767948204; cv=none; b=rT1a+38K3DVhyDi7xvaZHNc0+FfzfvrLTu89nJ6ewTDT+TZEjbEseH/ckN7qI92aEIEuoGkGNGD3D/4JVh7rC97659bQ9ngdYjraWVIdb2Hj/L0EBe2Y6uVVd/lfr99vAo6nHps1NGskwygvalt4nXLx6nP3b4fhn7OcriVhNz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767948204; c=relaxed/simple; bh=OONTHVOVMRtiB89j/sjykqGjnDU4uGuAZg4InjN++0s=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=W1k8iNgn37H/qufFGvrJnArKZoi6wRCLS8aS2oYanWcboXnmWmpTIu6+avfCgF6jFkHYFYs7piibAo3R6PrzXLcAHNO5CsKbhznS2A30pwfiVli0LOuRHS9uBQ5Jpx5oxujtIx6wSAXNwNgKaKfOwFm9tznE/vsbfaquu/TIfMM= 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.161.70 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-oo1-f70.google.com with SMTP id 006d021491bc7-656b7cf5c66so7612635eaf.2 for ; Fri, 09 Jan 2026 00:43:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767948202; x=1768553002; 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=cwyEDx5agYKQp0kqRkkJMLLt8xMt84Sw5WvYGgY62ko=; b=uz06gzqVog3fCBRq918sipIdWdjTbSCDFRwPtxtNCx5UqzqsOdwSMkrKnf9Z5CWuCb 13JA2nA3PnIgatFpqvTuI0Mb/Rj4QwivkiNpbpjFOx8UrrOdwGMjyOgAuw8Zllo70Mn9 GW4A0RZ3y911P+LaCCVRENArUgpIAh+1w15NabsB46HBa0RP7W0jVAhi1gdnJwcsu1j8 QMSRfStOJxAuNbS4Aeg7UWVUz0kF0qk8Ry2VBH8ETkSOOTDaGTd3lHSRWo2m/hcBGt/4 nlsCIuKegeVv2m++CnaH4O747NL7ZTLpTLsU9ADxbYNcKAHi79WczXVPOfvZEjm2YLLR hChg== X-Gm-Message-State: AOJu0Yyr7pDxk479OlKel5L7HaIo2z+8+CdiM3fo9uUbfcsek9JvytDG vX/YbUdfYFf3JRZQQbnzxLsaRtYCCkmvGcklMcEsoEDwiLxRrft4D3NSTxfRPRsFLdpzq8boYBv lZWSR8BKRID+oiRoYV0OvrZBa2eVP9H8nXlnnwVbKkN59aBC9E6seBZIfhZg= X-Google-Smtp-Source: AGHT+IF16/kEvlnonT9Kl7lPzoBs3Ga3T7AyU+X4IqNJDLUB3xVn8SNDno3XTpe24UZI7lvt2cvStgrUVOx0q9GOD/wn7OtRJ3l8 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:52d2:b0:65c:fff0:818e with SMTP id 006d021491bc7-65f550a3749mr3553559eaf.63.1767948202145; Fri, 09 Jan 2026 00:43:22 -0800 (PST) Date: Fri, 09 Jan 2026 00:43:22 -0800 In-Reply-To: <695faa63.050a0220.1c677c.039b.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6960bfaa.050a0220.1c677c.03bd.GAE@google.com> Subject: Forwarded: [PATCH] btrfs: reject devices with block size larger than PAGE_SIZE From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com 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, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] btrfs: reject devices with block size larger than PAGE_SIZE Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master When a block device has a block size larger than PAGE_SIZE, the page cache allocates folios that are too small for the device's requirements. This causes folio_alloc_buffers() to return NULL (loop never executes when blocksize > folio_size), leading to a NULL pointer dereference in create_empty_buffers() when accessing bh->b_state. The bug was triggered by mounting a null_blk device configured with large block size as btrfs. The crash path is: btrfs_read_disk_super() read_cache_page_gfp() <- allocates 4KB folio do_read_cache_folio() block_read_full_folio() folio_create_buffers() create_empty_buffers() folio_alloc_buffers() <- returns NULL (16KB > 4KB) bh->b_state <- NULL deref crash Add a check to reject block devices with block size larger than PAGE_SIZE before attempting to read the superblock. Reported-by: syzbot+b4a2af3000eaa84d95d5@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3Db4a2af3000eaa84d95d5 Signed-off-by: Deepanshu Kartikey --- fs/btrfs/volumes.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 13c514684cfb..1d529e408f5c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1341,6 +1341,10 @@ struct btrfs_super_block *btrfs_read_disk_super(stru= ct block_device *bdev, struct address_space *mapping =3D bdev->bd_mapping; int ret; =20 + /* Reject devices with block size larger than PAGE_SIZE */ + if (bdev_logical_block_size(bdev) > PAGE_SIZE) + return ERR_PTR(-EINVAL); + bytenr_orig =3D btrfs_sb_offset(copy_num); ret =3D btrfs_sb_log_location_bdev(bdev, copy_num, READ, &bytenr); if (ret < 0) { --=20 2.43.0