From nobody Mon Jun 8 07:22:54 2026 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (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 A79871BD9D0 for ; Sun, 31 May 2026 13:16:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780233418; cv=none; b=cBkpze/Pyz4VVbpe7m3yJq/kJWh7+E6JZy1GafwH0AI+RZ1au3TrQxFGbtln0/Crs7jhtURO7wE1JHQEH8ZCAbMRY0cy1bKcoqMEW9Uyc0v8D5tgpaAxjwE0zpxjtSkU/GypAO4ERwnpwDUixas1p7xJhpfLStQp57JJZx+y2Q0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780233418; c=relaxed/simple; bh=hHkUWnykRMnYqkkFtMRvUXNAtq/xVuTphwBeiPpcjrk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=uWfnddMSwGE9Aki/KzeDQKmXPhBnZdGQwBAr+fDDVHt70Mq7l3/FqtIl8XedPRxi3ceTYPTTi2TMrWNLifRFb3xvS84GYLorhrs62AjxxJNNY391+ZZ69ZzSQSN6cr7UM4GbujIShyoXhmiCxBh5GuDt0hjTyTWiaShnrRnHUWk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=J5vuH/Ix; arc=none smtp.client-ip=115.124.30.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="J5vuH/Ix" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1780233406; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=uClhD2qkjhCHrTWlrk62ItmQxyKP3gzB67snBT42Rp4=; b=J5vuH/Ix1MtJ5EV4Tq+A6LjZDIjTuSdEE8HZ0e+xr7e3TTUSGRj10fzDo+icQzexo1ZEVFOwJUgN6/u0J5UpVnCmO3IWmpGLiTK9cvecpKvzroSbNI9iXEm406wgTp4NnE32MhoMt5LGmYCMhjdyPb0rAmMLWbcJQVd1Au/XyJw= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037026112;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0X3tm8Ar_1780233405; Received: from localhost(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0X3tm8Ar_1780233405 cluster:ay36) by smtp.aliyun-inc.com; Sun, 31 May 2026 21:16:46 +0800 From: Joseph Qi To: Andrew Morton , Heming Zhao , Farhad Alemi Cc: ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] ocfs2: add journal NULL check in ocfs2_checkpoint_inode() Date: Sun, 31 May 2026 21:16:45 +0800 Message-Id: <20260531131645.3650299-1-joseph.qi@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 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" 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. 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 --- fs/ocfs2/journal.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 6397170f302f..f8b3b2a3d630 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h @@ -196,6 +196,9 @@ static inline void ocfs2_checkpoint_inode(struct inode = *inode) if (ocfs2_mount_local(osb)) return; =20 + 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 --=20 2.39.3