From nobody Sat Feb 7 19:08:14 2026 Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) (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 383BC3C2D for ; Fri, 9 Jan 2026 05:44:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767937453; cv=none; b=KbI96dTBOdxvIKOPtk6umUdkjk2YDi0DBOVm+ASAuXsIrd4HinUm8u2FJu+l1u4bxwm+3sJ2tooYJkUmBnRFOtCuIbe4fN5T3rfE3WtpOZQyFI1p/jHssmws6+NaC1MebjEcZ2otgjGvyXuzWSSd0MdcDqM0QIPWd+fWfpu71c8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767937453; c=relaxed/simple; bh=scgMDbeLUDDHCX+nYMyN1F3abO3jLVA1Lc8JilmSlqU=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=XBQD533qUCYunyt/Sw882P8jUjtcqFFT20u+iPHPcNpbqIk6PS3VCSRgOqPyVtBVLMGllJfSflT9b34RfkwCploaJQt6R7B1bogPE9CziaKrA5LOrxOoNk/qXaad4mwPuzFGdSPdCyLQYDKcG3u466Gc+UvWOGNBLJkosi6eEdo= 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.197 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-f197.google.com with SMTP id 5614622812f47-4537c9e1c14so5364120b6e.1 for ; Thu, 08 Jan 2026 21:44:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767937451; x=1768542251; 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=E69uS6xizCnmmOOzuSCqU3gmMOPDDvcOGiskP4lfoYw=; b=n0LpXaWDjM+SckMdtH0XDOcTrXX5158GeTVcDlHkzeoP9JgwYGvCRwvpm1FzgZ1Apc i/3UPpx4uyVkM8xcTAOgPl3qSj1riFyT4wcj5VoKYgG4JKx6KFNmOLRqIMbt0DRuE1G9 ioA2sbf6Umlpf/VDnhJA9NpM7dfP0BG5A3eYQvEstiVZC5KM8d7vSWldEIfDKI7kLgZn 6PDfmXvhdTGmJInp3gbJE/cIyzSP8LRqYQlTnWUStQ17IB85GsplrNLdzztC5wHqVlVw CyFJV7wKP9xbDcH3G2GRJl7JNs9LOGXCizA1c6Mibi5y+IVahxr1Ahry4Yu7DpcA8daK C3hA== X-Gm-Message-State: AOJu0YwlJekcBKNvFrWBiqOSEA/YVZAC0QX3g7ddn+AZFTLrF6oP3Z+F oMU03CnSo43gW4Kd4iGPbnfibWd0DSomvhesj9pQ+A/Lv6qe8hffCFQiXwOnJmw2EpahQfrOllP JQHIp0B2PVcc82w26n+aJd8ecbxa9OC6MBcacJ8Ca2FkqKUzSYyYM/UeOS+8= X-Google-Smtp-Source: AGHT+IF14NmF25V0+ynatvtI6oRrARLJR+vjUwJAgRRMFsiBs8g/mBkw6eZBsPTg6sOPz6LPci/EJiRX/0gWmkNJ0AUe0XDjpaRb 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:6808:238e:b0:450:c916:10b with SMTP id 5614622812f47-45a6bf3b8f2mr3128123b6e.54.1767937451158; Thu, 08 Jan 2026 21:44:11 -0800 (PST) Date: Thu, 08 Jan 2026 21:44:11 -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: <696095ab.050a0220.1c677c.03b4.GAE@google.com> Subject: Forwarded: [PATCH] btrfs: validate block device block size before reading superblock 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: validate block device block size before reading sup= erblock Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master When mounting a block device with a block size larger than PAGE_SIZE, the buffer head allocation in folio_alloc_buffers() returns NULL because the allocation loop never executes when blocksize > folio_size. This leads to a NULL pointer dereference in create_empty_buffers() when accessing bh->b_state. The crash was triggered by syzbot mounting a null_blk device as btrfs, where the block device had a block size exceeding PAGE_SIZE. Add validation in btrfs_read_disk_super() to reject block devices with block sizes 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 13c514684cfb..d79e2a19c046 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1341,6 +1341,9 @@ struct btrfs_super_block *btrfs_read_disk_super(struc= t block_device *bdev, struct address_space *mapping =3D bdev->bd_mapping; int ret; =20 + if (!mapping->host || + (1 << mapping->host->i_blkbits) > 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