From mboxrd@z Thu Jan 1 00:00:00 1970 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 0A28943F4AD for ; Mon, 24 Aug 2026 14:44:58 +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=1787582700; cv=none; b=J43cd2NBB3+r3aPsM5Ho8XelAAnqRKkHFLTMMudQr2t05Xdl1Rm9a3Z226elhpSGd54QEe4xykwsFuF3tjKGVUeB6N3pjKZqa3g4Azrre7Arbab81L93w0JOsM6xg4ChTj25LQVK00hfmbzx5U2oRHaLq8NCq1peGBncgj69ZTc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787582700; c=relaxed/simple; bh=qElLoDfyhdcb42ATgQhM92H08wn7Cw5DZ7qSj02j4bg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hHm5f4/QCY5WljG6uoC8Txv0PjzBZPygXJbDOimGx93zoOWSrziyLjn1AeEwAWhiKqYiYxFiGHz3AnB939mk4nlwIZ2/AWpjLoxIGalF96u+RGrAEtLyMSTXiocUBAuTb3XXAWMSqvcGPMzIR3dj8x9FFw13W6H84480XisYphY= 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=gqLOphMl; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Sd+NuOQi; 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="gqLOphMl"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Sd+NuOQi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787582698; 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=3XAYzlXublgAVX17Erk+AQVD3TzEZ8AvJwaJrSwAy3U=; b=gqLOphMlclbOrs/KHD/BS4RTUgalP1xOJyIlIONxAFio6ujpLKIPStjbCxY7eI0dcpOdLd 6vES5cC7hNB9rmONPvO62ONoH+H1EQZzo4ZFtpdhnt8LQSSueqLeqpTcYfqCk+p4Y2zreA FMHWX62gMYmMCQv0yIOqLxRXkelamtE= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-520-DFuIV27OPQGTQ9KSNqVmwA-1; Mon, 24 Aug 2026 10:44:56 -0400 X-MC-Unique: DFuIV27OPQGTQ9KSNqVmwA-1 X-Mimecast-MFC-AGG-ID: DFuIV27OPQGTQ9KSNqVmwA_1787582695 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-6a409088b6eso4720321a12.1 for ; Mon, 24 Aug 2026 07:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1787582695; x=1788187495; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=3XAYzlXublgAVX17Erk+AQVD3TzEZ8AvJwaJrSwAy3U=; b=Sd+NuOQizn6hNnhowlp+JDhrMZ0rQM0odiUIso5KfJA2qN2UvRSPT8U5QpdX6ZYjxd 2B8zuR7yeB+qQdzuJQdIIWm+NlSGba7503gcYhDC8B55NrLWBKskO/fzSpvgujgSOxL4 bb/5oZfCso5gG4ReYXUUaGVo4ofDE7F2CJr6OAeiPAA5EFx1hY3l8IFaOXoJ1grmsGOT jcsRIOKiWbpgoDs/7TU+AFya6wdiZLEzpdI/zeuWpPftOj4bMTbRGpU4tAshp1Axdpgk TSGY84YpyWNCrdSD2RnlfdT/p8PPaZu0JuY18OLvPcOAzw11MLqub+Tz8D93wBeyx4qo 3h/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787582695; x=1788187495; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3XAYzlXublgAVX17Erk+AQVD3TzEZ8AvJwaJrSwAy3U=; b=gdHxdaOTl75JNqxD0yJynIOFEqQsq6doN1Py/TzrOggYYxRl/mtjnfYzSPxPmQBTe0 NR7cIHxUEtB7jWQogoKV5xZElMvyMHp3EvpjtrMukPrF/da1GiHSdy5c/gjmAaNSTnay GoofnoGKK7B7VUdSlSCnqE7RP2NIKfG+IvBqku2FUBzc/ch/odEhJh+X+EOGWJBUg+1v 77XIlgkVpA3d7CU1Hxq9T6aLxmZ6F6PAJxFw04tb+zhbbHRG8qMnOmETmSZ6R/P+QP0l HyeJWm0K9sz5hFnFMmKt7esaav69HLVNwOsmAxQfPh5SH71FzW1xiDUscrl8I6Iu7rDm q3fg== X-Forwarded-Encrypted: i=1; AHgh+RrCkH8AG2CItXYC+PPCsjQVC2u83ijr7HveTg4SCymUmJwOSPI90wxFE0Ocahi+mIzpUXJ3tPKwz7t2EzA=@vger.kernel.org X-Gm-Message-State: AFuF++n9liuezcdfwGaviZHTPINateheceJkD+DbQtXjADophI9ev9Pn W6uG30xWwJKu4SNI015IuZj65RKUdZ/sGg5w1pnAAtfUtdjf0phd52cxhurQn1xUPw7tc2y6FUN OeE8HoKynGG4Nc1Qw+XACtCizxkJJXHaXusxPf98ZisMASPQczxa3Q2Y5AvHKJ3Mjsg== X-Gm-Gg: AR+sD10S273CSAG1tLsJXDu/v6QBXqS0scwn5AYgvDZxbj+YUGzdZ1KQzTXxJymDzFq gOczF4c5GiCzXFv01tbLEIuRZ8zY+Mn9UbCY+C0uDcJ8oamh6gpTjJFD8pUHLOM9+b4hDgxP2x0 v8m+s/vAC0uRqWS7YeKVxiqdIu5daWw4QCmWPHSHFN8eDqsRZOJj2zF/Jct37qdzeuXzD56lcNR yJO2GFgAl4gYfCZ+Yms8x/jFwYb+LSqhCuok9VICZreIPKAYnhk/go6GfGXHYyhqfAgO4XGxXTK nZZyM6FfvSHsqFKtwvYdIvjy6yk7S5hXHsDybfurmmzwuR5sJyeeDl3G0edEZDWyPBWy2mCTRYx UE/pmjCKWoZf5szG0zO77hHSME/dLJgmbWmVGwNYtnGgCrrfxn9hR6r6xpN2l X-Received: by 2002:a05:6402:7cf:b0:6a3:edfe:1d9a with SMTP id 4fb4d7f45d1cf-6a41123c23fmr23050720a12.2.1787582695446; Mon, 24 Aug 2026 07:44:55 -0700 (PDT) X-Received: by 2002:a05:6402:7cf:b0:6a3:edfe:1d9a with SMTP id 4fb4d7f45d1cf-6a41123c23fmr23050696a12.2.1787582695044; Mon, 24 Aug 2026 07:44:55 -0700 (PDT) Received: from [192.168.1.167] (cpc76484-cwma10-2-0-cust967.7-3.cable.virginm.net. [82.31.203.200]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6a59e012f84sm13240527a12.8.2026.08.24.07.44.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Aug 2026 07:44:54 -0700 (PDT) Message-ID: <9801cd18-e25c-406b-af05-ab0b21184b67@redhat.com> Date: Mon, 24 Aug 2026 15:44:53 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gfs2: Fix use-after-free in gfs2_remove_from_journal() To: Andreas Gruenbacher Cc: Hongling Zeng , swhiteho@redhat.com, gregkh@linuxfoundation.org, gfs2@lists.linux.dev, linux-kernel@vger.kernel.org, zhongling0719@126.com References: <20260617090143.735219-1-zenghongling@kylinos.cn> Content-Language: en-US From: Andrew Price In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 24/08/2026 15:20, Andreas Gruenbacher wrote: > Andy, > > On Wed, Jun 17, 2026 at 12:52 PM Andrew Price wrote: >> On 17/06/2026 10:01, Hongling Zeng wrote: >>> The function calls brelse(bh) but then continues to access >>> the buffer head through bh->b_private, clear_buffer_dirty(), >>> and clear_buffer_uptodate(). >>> >>> After brelse() decreases the reference count, the buffer head >>> may be freed, making the subsequent accesses use-after-free. >> >> When buffers are pinned their refcount is incremented and the brelse() here is only called for pinned buffers so I'm not convinced that there's a bug. > > Not sure what you mean by that. The patch still only calls brelse() on > buffers it unpins, it only changes when it does it. The context is not fresh in my mind but I suppose was trying to locate the UAF that the patch reportedly fixed and I couldn't find one. >> Callers of gfs2_remove_from_journal() also use the bh afterwards so if there was a use-after-free this patch wouldn't fix it. > > Do we have any callers that do that when they don't clearly still hold > a reference? I don't think so. > > In any case, if there are any callers that don't certainly hold an > extra reference, we need to be careful in gfs2_remove_from_journal(). > This patch achieves that, so I'm inclined to merge it. No objections here. I'd like the commit description to be clear about whether it's fixing a bug or just cleaning up a static analysis warning. Andy