From nobody Thu Apr 2 01:08:42 2026 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 8686B273D9F for ; Tue, 31 Mar 2026 00:47:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774918059; cv=none; b=hVED21gdlbPM5BViVf2VKH4L9U9EZRIF7daEE+BlpmgeOyif2/tDiXxnru2tmVxtrXeNcBMY4gKh23/M/ntIElKUq2ZuVrrp7/9NjZjJUqyPUpf02Lkq1C2KrKCJAmrfdNpUqDvP47pO7NFUmsUzxE4cBAE4JCDJzyFJTtWUB2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774918059; c=relaxed/simple; bh=31hyAr5qnO2ZAn2FtMQYOOoqve3sNAartVoxJqMLyQU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=n+wgrCrRoEKoTALYkEl+Y1Tgu2fzDfkpLOsXF6x9e3Sm7zfuM70MSYDJDns4xZx8SmbWGyH7s8fVs7pCXDmwUJlmjZrdypSXAftTLykyCA96hT2iNZkR8BQScQeKHEuKDUZRosH/WiiX+nlzZekzkFVOZ8TRNO88299oWvfD2fc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Mm2QM4jD; arc=none smtp.client-ip=209.85.216.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Mm2QM4jD" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-35d99031e4eso1498040a91.1 for ; Mon, 30 Mar 2026 17:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774918058; x=1775522858; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XEoCEuUEvibf+Zy7fuB4n/BRZrMvg04Um4zRjT0fesg=; b=Mm2QM4jDItawAOIyqN5cZGmj85Y4mSaRfM+yiRF8Zx+joNzHsSC38fhrHIUB6nh6+2 VRWvzvt3Opp+01uL6/FiYgsqXEMGSTrcH5DV1Ejnkz5cHyzDAt/RhFhhqACLkM6mZ1ej 1uamRIuxGyfEOtlctNQoqrf09B0PLxiSHS3FyWRxVZTpRSTeoBU2Z4e638syYaWdZqqP Ppeomrt9rVoe8uY7LdvWNjWOzT5pPIpVEEUKbfRf/TH5uMgubK7xTRyBqrLeSzq9r+w7 iGxQX0vaE0afjpT4LGMud2KCr8NymKS9ueVyECKXY2GKLFl76PvVeecJyiLA87OQR6SL 8+eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774918058; x=1775522858; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XEoCEuUEvibf+Zy7fuB4n/BRZrMvg04Um4zRjT0fesg=; b=gjouCmOspo6LJi7Q3aMHhkYYJMz/NTXT0nfCuFsPobLz+6kaCoxyEwAmRVEm13+2yE POk9O5DGoZqdNVx+pTpUcfq40siTDhLG5EgKGtlMPnQGDQea7D22y8DwQLpH4ug3jWcb cTK/iH6TZqwVLaixwo/TqEosI4fPJbsOTEbd59Q89apk0WykRJQ/q+IEcpuyPmFv/cbD TqvyLA0cbLbETmebjODEXhwkYz+AVsToDEK38DEs3MsBWmksjcPIH9bUzGD3YO51TEyK 9wq8MtGzTggOO1T5eLRItr255JwVAMbnJq/XdE+rxATuwh/BEXLzk+1K2JvCRyhiv9MU rTcw== X-Forwarded-Encrypted: i=1; AJvYcCVP62nuN5LfEmL3JG+PHhhnD2GIc2V3DYftuWsWxFd0NqJQXDk/VDlVjPoH0SlOKl0gMrhO8EVLGQsoEJA=@vger.kernel.org X-Gm-Message-State: AOJu0YzODqQtKQFf0xB5d2+pWBTnIB76uaf1okXkQw5I2orn/qoftdCX AqUkKBI5MS+LE6vzYhTz+Q4RmXmra2k53+JpEkyxlOkgMPNVQmI8drNO X-Gm-Gg: ATEYQzzzbuoP2+Ak4gG1qZHgS5WIjs5VW/FSWiyu+nRI9VKAJ7qEX0z9T0jpHkiYx4X uAjlCG2p5SdcqPC4CCOazAEHnlitsFtT82prHk6LkulbLrJ/ZVfrlce1CrMMYS0dexJ8mVnKRni C8/K7AwOi8bEhZHLN7VQzDkiLErIFtVVDRYe8F2Mggh4XDjEp/CRKXJKCewIFirAQA4JDc3PbAd EPeh9464BSb3J7RNyMA4+qBzvD2sBveRj8tLcFZC260B+rUg6xGvxJ0EgVMa69YeHO4Sf/iKiHp SDNeLGl1AmfJJVx7cTlf8SrGzmgOfpyp5OQOWtiOUtdSck92m3RhFQaLG7mKKDuz1lCYaIkAYTd Ovzzai6x04aYP4HqHsg8S5vbh6Q+jfv6EYiBuH+J9Q+HRwbjxTloRghyikAcrD4XioTQqCryN7p FezD4C0HXQZAUWc6u2YREUhPiVX6PpN8gfkmiOAX5xNijh1AE1LtsYDANA1dVere7FcfYlrm2ih YnRxC0= X-Received: by 2002:a17:90b:5203:b0:35d:a62c:19de with SMTP id 98e67ed59e1d1-35da62c1f30mr5556813a91.1.1774918057781; Mon, 30 Mar 2026 17:47:37 -0700 (PDT) Received: from carrot.home.local (i114-181-46-93.s41.a014.ap.plala.or.jp. [114.181.46.93]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35d94d053f8sm8608583a91.2.2026.03.30.17.47.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2026 17:47:37 -0700 (PDT) From: Ryusuke Konishi To: Viacheslav Dubeyko Cc: linux-nilfs , LKML , Deepanshu Kartikey Subject: [PATCH] nilfs2: fix NULL i_assoc_inode dereference in nilfs_mdt_save_to_shadow_map Date: Tue, 31 Mar 2026 09:47:21 +0900 Message-ID: <20260331004734.25792-1-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Deepanshu Kartikey The DAT inode's btree node cache (i_assoc_inode) is initialized lazily during btree operations. However, nilfs_mdt_save_to_shadow_map() assumes i_assoc_inode is already initialized when copying dirty pages to the shadow map during GC. If NILFS_IOCTL_CLEAN_SEGMENTS is called immediately after mount before any btree operation has occurred on the DAT inode, i_assoc_inode is NULL leading to a general protection fault. Fix this by calling nilfs_attach_btree_node_cache() on the DAT inode in nilfs_dat_read() at mount time, ensuring i_assoc_inode is always initialized before any GC operation can use it. Reported-by: syzbot+4b4093b1f24ad789bf37@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D4b4093b1f24ad789bf37 Tested-by: syzbot+4b4093b1f24ad789bf37@syzkaller.appspotmail.com Fixes: e897be17a441 ("nilfs2: fix lockdep warnings in page operations for b= tree nodes") Signed-off-by: Deepanshu Kartikey Signed-off-by: Ryusuke Konishi Cc: stable@vger.kernel.org --- Hi Viacheslav, Please queue this patch first. It fixes a potential NULL pointer dereference defect that could be triggered (likely most cases are intentionally) via the GC ioctl. Thanks, Ryusuke Konishi fs/nilfs2/dat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c index 674380837ab9..888dc1831c86 100644 --- a/fs/nilfs2/dat.c +++ b/fs/nilfs2/dat.c @@ -524,6 +524,9 @@ int nilfs_dat_read(struct super_block *sb, size_t entry= _size, if (err) goto failed; =20 + err =3D nilfs_attach_btree_node_cache(dat); + if (err) + goto failed; err =3D nilfs_read_inode_common(dat, raw_inode); if (err) goto failed; --=20 2.43.0