From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 615C717555; Sat, 30 May 2026 18:24:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780165450; cv=none; b=TpGxbWDFczyBf0csE2buuoySqXfH5aKUziOQs+X0PfHmKOkYYUHFfmyQrupF27IeHFC7emw0o/OSNazMfLVgSgEOFZuAg9lu2JCghkhYPM8ev8zU0HzYKzIsQDKgdZe8QpRulMY7lXVqGFrqlteqZ4uiI+oUVmOhpijoJGhNAUE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780165450; c=relaxed/simple; bh=EFf2e5EOavPIvKjkih3yRXPl3pjdEMA1KEQNVe3NxUU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KWqU+C15hoDZFW4ajGTPADf43tlhAYTnqZ2Pa8wj3HBZOo0vZ4mua8hXLKLK+6aaOSXyLY8F2fahMXhpuWOyudA9DKijK40xv6XkDIphAhVZBPd8kauMewhZV3AvxoK0jiXdPRVu2l7pWquK75HaxDGBw+H45Rjq+BeSsszs0Sg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tk0XEBat; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tk0XEBat" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A52B11F00893; Sat, 30 May 2026 18:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780165449; bh=AIRNdpSFv7zHD6o3UP0YUDTS6SRRJKFTaxhvZLHXPN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tk0XEBatTK2C56nRhqRapog6v5PkpYlVzZ+FyF+T6eY8r9p+SHaZlbQngHjZMG573 WHrMKkHrncAqV556ZR054TSFanrA9s6b/eYB+Zl9KooX3ze5FVBmFAvC+L/3uJvOpc gCpcWQmLjz57nlEyAHCUIbEurUan7t7ntgXsPCA4= 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 5.10 081/589] nilfs2: fix NULL i_assoc_inode dereference in nilfs_mdt_save_to_shadow_map Date: Sat, 30 May 2026 17:59:22 +0200 Message-ID: <20260530160226.785153237@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160224.570625122@linuxfoundation.org> References: <20260530160224.570625122@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-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 @@ -515,6 +515,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;