From nobody Tue Apr 7 01:01:12 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 686E434321A for ; Tue, 17 Mar 2026 06:47:45 +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=1773730067; cv=none; b=PXa69stnX+v6PLPSWDeXHL4og3MND0Ud6Ix2yXKkZpyBC3r0+1YzpiyXObDw1nXx28/xpixoY64QFUpvpu2KPtnsuB8/WxPykk0HAq/grRlRYdAdFRN3YFMGzxFblaXepRjw5ZtU4rEAVRfONRaAGTZT1oEuw0KVJDo8Ho5W4uA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773730067; c=relaxed/simple; bh=JYp18bCuyTj0KU/G9ASwMIzMok0Yk/0hIr5hpXJkfps=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=DBal8ZHIZ0pmaaJKGVF7S/6LU+fB5AIvkjamuTlVqO7aWfczjc6AfKKJiN/jBC3AVkWVjOCyKL1jq4t32vX2AUfjKjHa88ehTCc/J7kwvhg8CV1uOBhhkz+Ina5Dw+mtbaXn/FjJIttEnQiuwXb4dkLsl2c4PU/SP8Ff6gzwBvI= 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-67ba8269efaso43536593eaf.1 for ; Mon, 16 Mar 2026 23:47:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773730064; x=1774334864; 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=zdDIfQX0xXhqk/ddfTP3aJFtDfAMC1DnHSHoHzgyGao=; b=eGRoRPpaUlvs9v4ZXaGgT3DUWE7I7wnqQ74nHpqr1NNluZ6WPvgtctqVjbwx7K1dIC 5aaBBhLGKzJNPxsQrIq3LX5QlwbPJV+Dr314BucaUK5qxoL/Ypq8FVkbbaf8s2OId8UB vTlHSYunFG4lCy81dz/EHzqq8+LPMjq54py1kBz0A1DTYfMZiCb0Olg5DjK57EGW2/hb y3vVtH7b6RLcmROr4u0vKXEiYlRK9EHuwW5XiIDf3+yG2xA/Cf8kh2stZjqb0uyf0MpP +1ryuOj1TxwTAI+kv3k2raYdvn6Rl4ZSKGacPFFy0Kn/X/HHJFE6BzOLuCPXQvZGuwY/ WqNw== X-Gm-Message-State: AOJu0YwSvvvByTAh2YonGu5iyWec/OCafrLNeIDzZ3AtXR6Xxp4kN3+t g61Ufe+Fc6qBn5fTOKTlIOg1f8SHMenhDJdbjMHXPyE7qA8oSCsq432jk358tfKL5Zax/zV0X7c 7Hw2voFNzyILVUdafRdR9sHqHnMRKpvRVypgViB/1SyW075X3w00/a8hdC50= 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:211:b0:67b:ba75:3e96 with SMTP id 006d021491bc7-67bda98267amr10312445eaf.7.1773730064367; Mon, 16 Mar 2026 23:47:44 -0700 (PDT) Date: Mon, 16 Mar 2026 23:47:44 -0700 In-Reply-To: <69b8c713.a00a0220.3b25d1.0029.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69b8f910.050a0220.248e02.0128.GAE@google.com> Subject: Forwarded: [PATCH] nilfs2: fix uninitialized btree node cache in nilfs_attach_btree_node_cache 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] nilfs2: fix uninitialized btree node cache in nilfs_attach= _btree_node_cache Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.gi= t master When nilfs_attach_btree_node_cache() finds a cached btnc_inode that is not I_NEW, it skips nilfs_init_btnc_inode() leaving the btree node cache in a stale or uninitialized state from a previous failed mount. This causes i_assoc_inode to point to a broken inode, leading to a null-ptr-deref in nilfs_mdt_save_to_shadow_map() when NILFS_IOCTL_CLEAN_SEGMENTS is invoked. Fix this by calling nilfs_init_btnc_inode() for cached btnc inodes as well to ensure proper initialization regardless of inode cache state. Reported-by: syzbot+4b4093b1f24ad789bf37@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D4b4093b1f24ad789bf37 Signed-off-by: Deepanshu Kartikey --- fs/nilfs2/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 51bde45d5865..8312abbe343d 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -631,6 +631,9 @@ int nilfs_attach_btree_node_cache(struct inode *inode) nilfs_iget_set, &args); if (unlikely(!btnc_inode)) return -ENOMEM; + pr_err("NILFS DEBUG btnc: btnc=3D%px I_NEW=3D%d\n", + btnc_inode, + !!(inode_state_read_once(btnc_inode) & I_NEW)); if (inode_state_read_once(btnc_inode) & I_NEW) { nilfs_init_btnc_inode(btnc_inode); unlock_new_inode(btnc_inode); @@ -686,6 +689,10 @@ struct inode *nilfs_iget_for_shadow(struct inode *inod= e) nilfs_iget_set, &args); if (unlikely(!s_inode)) return ERR_PTR(-ENOMEM); + pr_err("NILFS DEBUG: s_inode=3D%px I_NEW=3D%d i_assoc=3D%px\n", + s_inode, + !!(inode_state_read_once(s_inode) & I_NEW), + NILFS_I(s_inode)->i_assoc_inode); if (!(inode_state_read_once(s_inode) & I_NEW)) return inode; =20 --=20 2.43.0