From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8949C2853F3; Mon, 20 Apr 2026 16:12:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776701557; cv=none; b=TUCyCd+mOYiCCG7oBGe3i8ykASsBYLqRzS9xkWdd5rPtGo5r2VAm40wQapURtPLi64PEiTnJiqOH9+31dGZVvxFW9lgCqcedybageSY78htFS30XfuAN6sSlrarXlJ6ZJeaCb9El/K2g5/2ad4VkSlRREyC5h8ploDPVYyn26CU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776701557; c=relaxed/simple; bh=Eevp+sNcesNVsbSyNDqd5Fba8v3lTv80wpZFzPttnD8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A8Ywv5EqXzRNrZninpNKtEpEfI3HnZP8d4v3NKFo3bK5gE0D3QVCsjhb3Y9gcU05dAWhZYy6tE2PcFK4MHcFyjQSl8rPkpKE617Vm2lmpS3K465Fd9GbAjafnmORtPBo2S3yejl1jr21wlFwtNNoYj5qKU9VYpKJOxZ9MRS0TH4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DthaVn9Y; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DthaVn9Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F5E0C19425; Mon, 20 Apr 2026 16:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776701557; bh=Eevp+sNcesNVsbSyNDqd5Fba8v3lTv80wpZFzPttnD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DthaVn9YjL37h0KP6+8QxjZX2zQbjVa+c126DdhVafJ0G+9f3IngovmwzUS30hGRA Sybkqi3qhEPsTQY9I0m10ibG8HK+ZtbG3avZxpFgP4unJ8d3sH16XSNBc2I7uMO9qj APXVtJV1x5Jw6Nrcw4U9lCo1XlMZTfJ+mvg3lRQE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+4b4093b1f24ad789bf37@syzkaller.appspotmail.com, Deepanshu Kartikey , Ryusuke Konishi , Viacheslav Dubeyko Subject: [PATCH 6.12 153/162] nilfs2: fix NULL i_assoc_inode dereference in nilfs_mdt_save_to_shadow_map Date: Mon, 20 Apr 2026 17:43:05 +0200 Message-ID: <20260420153932.591629020@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260420153927.006696811@linuxfoundation.org> References: <20260420153927.006696811@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Deepanshu Kartikey commit 4a4e0328edd9e9755843787d28f16dd4165f8b48 upstream. 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=4b4093b1f24ad789bf37 Tested-by: syzbot+4b4093b1f24ad789bf37@syzkaller.appspotmail.com Fixes: e897be17a441 ("nilfs2: fix lockdep warnings in page operations for btree nodes") Signed-off-by: Deepanshu Kartikey Signed-off-by: Ryusuke Konishi Cc: stable@vger.kernel.org Signed-off-by: Viacheslav Dubeyko Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/dat.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/nilfs2/dat.c +++ b/fs/nilfs2/dat.c @@ -523,6 +523,9 @@ int nilfs_dat_read(struct super_block *s if (err) goto failed; + err = nilfs_attach_btree_node_cache(dat); + if (err) + goto failed; err = nilfs_read_inode_common(dat, raw_inode); if (err) goto failed;