From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 C25F81C5F13 for ; Mon, 1 Jun 2026 03:32:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780284748; cv=none; b=jUNF/Udrj5Lcs5uINVLSQ7hNHveeNrTSmNk3yfW9r8narojQwVu6Mq2Z+uObta2XyVvIeoVCmoZHx49tM9gkeyNDN7F4WdjwIhjJqarf8DdKmI60WloS/U5ViJfKitnp9M9jZGD7DKqqAC6RtG4DQPutBBQbDE1x/32kufUPP8Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780284748; c=relaxed/simple; bh=Ez4+pddAX91CJpxsPk8EVjvdomZKOM/Oayp8GRL1x5w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qcJdMrRoh9sqoZO5vQYjpDKb25ttNsEImJJh84IzwQFad5Vzv1bBKcFRZhLd/dC81fp5kZ4dmOvTLfecFd/tBkcwHjVBhoMAEIAPwAKT8eKov+wSdF9STI3N5LU9QiGi9/Qgh9MYOSDD1Jn4TrlOPOrL+9OhsAL9DfmYoj60VfA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=aQCPca3k; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="aQCPca3k" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-45ef74860bfso47788f8f.1 for ; Sun, 31 May 2026 20:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1780284745; x=1780889545; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SAGjCkfmtz6WXqXlINsXqWBTT+9LX3eW3SU/43Z592s=; b=aQCPca3kYp9fUYoGMV3Vqm9Gq2aw6ofiSR51r9usjPfs/zbR25cJqdpwhj2SvRy5H/ pECqGoAIZzy5DWfBU+KN37fIHFLfbRp5K+Yc0FzJtuL+j8Q+wUySfJiIIRB0nzJCjAeh nlMeNIq6kxIc7doo1EVsHe901zMA+5m6wbb0HxCUUCI7L7c7rSkCTIAAzTXqPSMw3ORS 4Kd6MS2uaBKhgmkQ1d+d5k1IMoZhg31mJFwcXNXi3siyaj7d8K7PZS0zz3+HCAP/N70R 4gkVT6GRPVfQqSiMVBYAKYzRLoH3Q+H08RqniXfrftOyrjmEnBdojFxqN142vjfkknhB t9Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780284745; x=1780889545; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SAGjCkfmtz6WXqXlINsXqWBTT+9LX3eW3SU/43Z592s=; b=moOqpV4F2DAquXu7E0bgB2BQl7yXpkuUJvIGB2c0cA6ZCHVohArY2gheCL3t7Kuorg ErXB+IGi8mUKAaVS89pnVwYbV4LR50J8CwHiLAl70urZIDEGm5n6ZHmjNMv+qKyIy5PO 1wEKeMQ8/bmn+EYqdpiU37cYygM5q2DO/t3D0VhRWbHcByHJrXgtNNshsNi97WGbng6M To6UKXQszq/hN4nAvx3TjLUwwBBoqvjbbsEMvxBGnQuNW95PIr28d4B6h7qB7wJ7Hvo/ WKw0qsXv7Q2r8uGmBAO8Py5Rgngg652CD5yAGRzd7uis/+rAsawi8sLKeoZr4FGLc9L0 1gsg== X-Forwarded-Encrypted: i=1; AFNElJ+dFqR10DVAV1S9wpU/l4e6pqA8/x5Efcdok1rSjthH5t8c8iyzsiAIIti2l85An2bDm6i7HJR9eCv1bjA=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9Qkr7SAO/VZHkhEvzdOASsDrTc7AkK3dwLPUYuNTH2L4tDXBG dxI0xr+LiKF5FYuV7ehpdwDFM95C75i9+vayewPhuslOKtUj68zBFUBuFdNpUUTI99M= X-Gm-Gg: Acq92OHl208KgxI5p1laYfgtoFn5EzUCuHFRvVp9Mab3iWCthIXKEA9RcgJhu6PPuOU 0aweI4qJhkcoWBlIWZkASQ2IZiHhmHrqge5qbqW7mhdlc+rzvU9P+IK3PLUWzpH7OcjywMHDP7M W3r0mznNqadJG5QXh4i9LRmiai2zskR4KwfvAaJJNuR+NAdDtIh3bKS2XybInmQ004GD5JcEgOM dy30SPBqUMOfvTQavo7VM5AmncG5yDSGNtlHpNsomYg7zoig4cNo0oOueLDrm3+bDC6HE7H72M2 n9Q2TmqvlzMCXDapYNV1I6cdTX2vBJEJNrBZNfZt7FGIHczhnDpZ9vlKIY+PICgDR/q5wQ7gY5l elIZytDsji3VZwg2Nmw7EDPCx6BilMYAUAs7lACKMiXTs19QUhIdoLm3008RX+j+XxdOD8rTnYI tw1uLsdbY+d6h3u0wEqxf6hKaQGc8dnR27 X-Received: by 2002:a05:600c:4f8e:b0:490:3fdd:d344 with SMTP id 5b1f17b1804b1-490a2910990mr65570835e9.1.1780284745146; Sun, 31 May 2026 20:32:25 -0700 (PDT) Received: from localhost ([202.127.77.110]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36bbdcd0a2dsm5345843a91.2.2026.05.31.20.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2026 20:32:24 -0700 (PDT) Date: Mon, 1 Jun 2026 11:32:21 +0800 From: Heming Zhao To: Joseph Qi Cc: Andrew Morton , Farhad Alemi , ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ocfs2: add journal NULL check in ocfs2_checkpoint_inode() Message-ID: References: <20260531131645.3650299-1-joseph.qi@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260531131645.3650299-1-joseph.qi@linux.alibaba.com> On Sun, May 31, 2026 at 09:16:45PM +0800, Joseph Qi wrote: > 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 > --- > 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; > > + if (!osb->journal) > + return; > + In my view, the code is correct for this bug. However, the if condition is insufficient if ocfs2_journal_shutdown() sets "journal = NULL" immediately after this line. Thanks, Heming > if (!ocfs2_ci_fully_checkpointed(INODE_CACHE(inode))) { > /* WARNING: This only kicks off a single > * checkpoint. If someone races you and adds more > -- > 2.39.3 >