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 B35403C140F; Wed, 20 May 2026 18:12:52 +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=1779300773; cv=none; b=EpYK96cK3EasWRfqv0FY+xTddHS2wv0XwNBXHAzSGZlk4IfiKfJXJcevAZf7/zJ+nK8D8awouwAxRjPCNO/TcqzF2kXoNvEQJMWxWpTnLsE46/mjkwgATgtu9QfIA0WEp/zCDB7RgLLCoMYBOHRIPsnuBzI0QJ6xN5yKpYOJ+Mo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779300773; c=relaxed/simple; bh=wJ7hU3khEqSC9ZAcInkWzcq7QGA/WJQ4ToErhfAKuZo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U5u5+Lokn9/wy17zLmYueBLiqE1zwwTJ8Zosx2doJytDDv+kq9pLMY8ZSacKu5TW29ayujLWZLKNKvocxj4uzXyEm4b00/CRw6NNPHqmvXFqOOWdTa9cf05BWObymcoSfRIVR13TUcwKojOXflIN0yug1lDs/aF4KUC7vx0EPWE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=t+FB5fLF; 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="t+FB5fLF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22DEA1F000E9; Wed, 20 May 2026 18:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779300772; bh=1tBVHEZsqVFnUZglCdsLXx3dOjf6SomyBbfXoa5NSuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=t+FB5fLF87a7UOkJ0RRlrXXnzbPN0ANEJXnhkbB81H034aa3isVmKVM6T9mqsSu1P pTTumsCNd46eLt+KzcrazSbirmUClkIO53cCSo4IkuskA2IFoHsOjyMdN/ssGWvkx5 d3IsGleJ8PzWFYbHBQ11EgitccKEMyNY5W6qgcck= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, kernel test robot , Dan Carpenter , Andreas Gruenbacher , Sasha Levin Subject: [PATCH 6.12 260/666] gfs2: prevent NULL pointer dereference during unmount Date: Wed, 20 May 2026 18:17:51 +0200 Message-ID: <20260520162116.853456367@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162111.222830634@linuxfoundation.org> References: <20260520162111.222830634@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: Andreas Gruenbacher [ Upstream commit 74b4dbb946060a3233604d91859a9abd3708141d ] When flushing out outstanding glock work during an unmount, gfs2_log_flush() can be called when sdp->sd_jdesc has already been deallocated and sdp->sd_jdesc is NULL. Commit 35264909e9d1 ("gfs2: Fix NULL pointer dereference in gfs2_log_flush") added a check for that to gfs2_log_flush() itself, but it missed the sdp->sd_jdesc dereference in gfs2_log_release(). Fix that. Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202604071139.HNJiCaAi-lkp@intel.com/ Fixes: 35264909e9d1 ("gfs2: Fix NULL pointer dereference in gfs2_log_flush") Signed-off-by: Andreas Gruenbacher Signed-off-by: Sasha Levin --- fs/gfs2/log.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 592f69602e5aa..ecc5c59b87008 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -471,8 +471,9 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) { atomic_add(blks, &sdp->sd_log_blks_free); trace_gfs2_log_blocks(sdp, blks); - gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <= - sdp->sd_jdesc->jd_blocks); + gfs2_assert_withdraw(sdp, !sdp->sd_jdesc || + atomic_read(&sdp->sd_log_blks_free) <= + sdp->sd_jdesc->jd_blocks); if (atomic_read(&sdp->sd_log_blks_needed)) wake_up(&sdp->sd_log_waitq); } -- 2.53.0