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 5CF5E30EF7E; Tue, 21 Jul 2026 19:56:06 +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=1784663767; cv=none; b=eyvcWEf4lKJClYAAPKu6vTJsDcmh4CVH8pcHME7a2DGVmJAPqLvsHBCBs0HHQZyJqc7CTrD9dxYvdprm9uO0Gb3ZpTvxajhZYbp1xDtgP9nIF5RIU1bioXDL6UjYxBlFP1f8YrvcZjGibxSR/2MQb28y7IcNG1f4FYUZVjDLmfA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784663767; c=relaxed/simple; bh=MvEOHBMSzKrX29tu+NwSGq/TxR9tKYFMDLQqoIzHhDA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mz1mpN4d7vmiJJ0hTmuPoLrS9e0o1cAuiTHeYfHubgvP2W9ksqPqooypiAHe72vDoQ/6oLBEdWzmO+pK7QKANnj/mV57VmJKVzL/CsCWK+IyLXUq4pxoHIz7m7Lc15BI5GcA/jRRzSLxUNcRNgzKFGuklk3VeEL78jcg3FVu8NA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=S3eCZDzX; 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="S3eCZDzX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBDDA1F000E9; Tue, 21 Jul 2026 19:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784663766; bh=HLIwNtm3bcesq2MsCCw5Y80brooG0TrbIIU8W+jT31o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=S3eCZDzXUUSbpu0A0MftgJIEjZQkeyE4N31VOe2S4cysOV8loCRAb7oo3ZwGYXt7w ow4QxdWLlbKET30sOgn0VSul3w7/9e0pdHpFsLK4eTsdaA81Pp2dTCp1GwNkFa4QBm Ziy9WoeAQHOjXlEI9NaB6KyJq/RDixAAQWiL9M90= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Farhad Alemi , Joseph Qi , Heming Zhao , Mark Fasheh , Joel Becker , Junxiao Bi , Changwei Ge , Jun Piao , Andrew Morton Subject: [PATCH 6.12 0947/1276] ocfs2: add journal NULL check in ocfs2_checkpoint_inode() Date: Tue, 21 Jul 2026 17:23:10 +0200 Message-ID: <20260721152507.223451382@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@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: Joseph Qi commit a291c77c034b7a81849ce9b71cc9ecda9e587d89 upstream. During unmount, ocfs2_journal_shutdown() frees the journal and sets osb->journal to NULL. Later, when VFS evicts remaining cached inodes, ocfs2_evict_inode() -> ocfs2_clear_inode() -> ocfs2_checkpoint_inode() -> ocfs2_ci_fully_checkpointed() dereferences osb->journal, causing a NULL pointer dereference. Fix this by adding a NULL check for osb->journal in ocfs2_checkpoint_inode(). If the journal is NULL, it has already been fully flushed and destroyed during shutdown, so there is nothing to checkpoint. Link: https://lore.kernel.org/20260531131645.3650299-1-joseph.qi@linux.alibaba.com Reported-by: Farhad Alemi Fixes: da5e7c87827e ("ocfs2: cleanup journal init and shutdown") Signed-off-by: Joseph Qi Tested-by: Farhad Alemi Reviewed-by: Heming Zhao Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Changwei Ge Cc: Jun Piao Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/ocfs2/journal.h | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h @@ -196,6 +196,9 @@ static inline void ocfs2_checkpoint_inod if (ocfs2_mount_local(osb)) return; + if (!osb->journal) + return; + if (!ocfs2_ci_fully_checkpointed(INODE_CACHE(inode))) { /* WARNING: This only kicks off a single * checkpoint. If someone races you and adds more