From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 05FCA2ECD1D for ; Mon, 1 Jun 2026 07:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780299770; cv=none; b=itxPqcevLvo8uLlG6zzza/djeM7OSCa9hcjzXvHSG1ZQkQbk/wuhCqSfM04TvIj+qufgop/xkDKuNf5uko9CYNXeeQiJj1pzr6xEq/y60D55H4nlIUMi0N/c2weiEwaI3Ik5A8AMVi+VGura7cM1V/04KRu+ZVVHXEmtK0E1660= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780299770; c=relaxed/simple; bh=MQlkpCXOfkFXYHn5hTfIkSda3DcbkmRlTIqP2zAegBc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fG5qxm40cSAcEpT1doN4dAIFLENKxEoUb61cycXAyAXztzoyDr5zqcKf030XmEXwQsQNoONwJlXR245rV4zSSKINvNl07JJaaAzv9mYsWbYns9u7OIaYtPcdgm15t37hFBIVbxhVo7dhgBKu98MtH67lOYV+6m74HOWvzIHm9JA= 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=UwAM6wNg; arc=none smtp.client-ip=209.85.218.42 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="UwAM6wNg" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-bec404ae27bso3715666b.0 for ; Mon, 01 Jun 2026 00:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1780299767; x=1780904567; 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=1IusEb6RLqw9/UYNFngRbqN9yEMuGucdhl2O7Tgx7HU=; b=UwAM6wNgMCcYEjKPdw6LLtI/6MBKxlc+gQ1cTGnQIUFjbQeA0ddgIwBO6xq3hvpILL G8cSuglpP3TvYNe1grFdreELmZx+e5FmQ97RkXvJS8icQD2hxyzI87qlgagz8A+3nYY2 pAEOeL54iskgfrcAWQM4eUDwRQY7ZQdLkJBXMeDTymCS2eLU0fCy7/DMCwZCvhMyMHmL cKysndoRh1a9eOSNkQfCRfJmNqezMQPC2x/5iSdZ3U6zq8kTJ1KQKCp3tGCBoGnX62w4 3XRZtF3ygRFTJVoo3ufLbjmd1yV/iRkFIdEAR6JDpf+4o0RkREStRG6rUUZygk3CYJim ukXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780299767; x=1780904567; 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=1IusEb6RLqw9/UYNFngRbqN9yEMuGucdhl2O7Tgx7HU=; b=V0K19FlrhUSCdxSXFTqMmgbg1CDMJM6HsAJPkPeFOeTAHD5Rm73+VRDDZjQcKAe/3N OwAXrRjy9NZ7uGUMbIkVXWp20XinemDO+ZsOHe1YThLAvspDrTr31tPzKAVsqrc19xTh y+BwFUTHqbYCV/7MUaokaM9vQmyapjXS1CVa9/z0wTw0hlsgMQf7byX8yq7rvdp45fG8 mLC1ExsylgAuLfQy57v/VbI4wny25NT11iODH8HkGsjoc6/n9LSM4jiRt92RZtav82s0 uGv70M92LLagCqr117wgbHSzxglDG3mQxIKA/VWWsaiDDC4NlcGJUO1MoskUAEV7ta2x tzyw== X-Forwarded-Encrypted: i=1; AFNElJ83GM2nD6XQtmfrodAZV4g62WPx0UPpDXNfQIpZO2PhDBn0+KoIAXdD6iLn58Zd5isoP0hs75S0HNXByU4=@vger.kernel.org X-Gm-Message-State: AOJu0YxLc9d2LmY1asbQzdkxyUSdjJgMmfUaZCBpDJlKVJtZBHIF/RWB n/8/3gSJ2j8hST5IqMJ+YCdlPqSDvTH7fc2YeHG7Et1rQ4lAUYZypohDu32oySiHwLk= X-Gm-Gg: Acq92OG/9EsCCr+v/xWzdCjwalV8rYQOlkl8hKRohvxPbwTcGun/28DERvy2Jd85RvB 3YddExsgkgGe/1IPja+sB+2hWWtJprvP7Evpo3we06YBdZtf8gvz8D7ZBVCO5wp5sii3KVVF2KV CRAdHZ4802tSXlAOeyP2Rk/EplWoYbMibr5vG7ZiuiyReyAqKTS39sIqFlPjQY8yGPx69ZHuVxs 7brehqQD/iGEtvqC3roR+5jIzDstGsFOPDESVMA2QX3a/i3lU0Y9wtlI4f+mOj14HUVOPfzHRZr wqGkZ4lOnJyjsNzPsX7Dm8SjjH3rWq6L42KtYUZ1hVM226XjQn1erJLIb1Mv3Dl/IDPxgL40Vn7 GcOKpb19uG5Wz0OoI7+BoaJRKotZckHc2UJSAHC70BVu8HND2EdIWWAIkOclqO1AyGJ/AdyFvX1 MPMtZw3tXJ3477iHTppNYnVow3TE22676N X-Received: by 2002:a17:907:da15:b0:bce:9695:ff63 with SMTP id a640c23a62f3a-beab265be90mr228282366b.6.1780299767377; Mon, 01 Jun 2026 00:42:47 -0700 (PDT) Received: from localhost ([202.127.77.110]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-842269d68c5sm7025739b3a.27.2026.06.01.00.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 00:42:46 -0700 (PDT) Date: Mon, 1 Jun 2026 15:42:44 +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 LGTM. 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; > > + 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 > -- > 2.39.3 >