Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 A50633C9EF1 for ; Mon, 13 Apr 2026 14:52:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776091968; cv=none; b=QvWdvGmmn9QJ7zrSWy6TZLg4fTjVBUTdBE7y373nmWTsb5P5+J/K0tMKmFFkBPUO9Wo4WPlg3YyNa6OOfb8av+CiWXptdk+jOnUKRBn5VheojnfYyyacSuwO86BxeqyRgHkRZmVj+i6645w9KWOj6BAaLwcPE0u2F5l6s7HfC8Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776091968; c=relaxed/simple; bh=TKcU5HUdOQK0/0KhmF41x8nzXx3yCC1nhm60Inqp/1g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=ks1MpX/GRI/lZRG+TmVfIIhiZhdp8k3ZTQkaYFUyj/PG59gVqCFBD9YdlX49XKoOmvQ4FZW2tKflG327feJFXmceXAWa0ovpdGnaSnFCrCLZfwY+bCFIglhXBv/NIL5vbG0j/cG4UgbWMZ6vaM1bWVWk4KDKCsaK27n1cy5Oo3k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Yn4c2X/k; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Yn4c2X/k" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776091966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s2W5gy2KZ8bG5/Uh9dN+4WhuAGO9v7itnHTSbkR7/Bg=; b=Yn4c2X/kjfr1SRE9CuXCn5s5wuVbmvh6SSy7W+5pLhgP9ip207c/0KW9XjN8hrZ3f7TX6p FKc/fkpCFdrdRw5JEtMSxBXNfOO7EruyRA6SyqfGO7WjvgYEn6I2n+bvd3wozTzXLBm5Sk WZvFe6sd64U95X5AfVhpM816Tiu535I= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-230-a5Q-PEzkM7C-6CPuAnOXWg-1; Mon, 13 Apr 2026 10:52:42 -0400 X-MC-Unique: a5Q-PEzkM7C-6CPuAnOXWg-1 X-Mimecast-MFC-AGG-ID: a5Q-PEzkM7C-6CPuAnOXWg_1776091961 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 76BD819560B2; Mon, 13 Apr 2026 14:52:41 +0000 (UTC) Received: from pasta.fast.eng.rdu2.dc.redhat.com (unknown [10.44.32.156]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DEFE819560AB; Mon, 13 Apr 2026 14:52:39 +0000 (UTC) From: Andreas Gruenbacher To: gfs2@lists.linux.dev Cc: Andreas Gruenbacher , kernel test robot , Dan Carpenter Subject: [PATCH 18/18] gfs2: prevent NULL pointer dereference during unmount Date: Mon, 13 Apr 2026 16:52:11 +0200 Message-ID: <20260413145211.881752-19-agruenba@redhat.com> In-Reply-To: <20260413145211.881752-1-agruenba@redhat.com> References: <20260413145211.881752-1-agruenba@redhat.com> Precedence: bulk X-Mailing-List: gfs2@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: YC5NWAb-5fRSxFrRfOjIAi0tHUWuMrRwmeaG4Yz2R9M_1776091961 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 --- 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 3a01d4e7667a..78bba8cc10b8 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -467,8 +467,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