Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1180396rdd; Wed, 10 Jan 2024 11:02:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRRQTVu7CmWO/Suvh7IVX8UAParqzD5nZq5JKc7GBdj2rPk2D6v4GOMJD7s1mLqSEy3CFd X-Received: by 2002:ac8:5fc3:0:b0:429:b4d9:982e with SMTP id k3-20020ac85fc3000000b00429b4d9982emr17937qta.98.1704913320817; Wed, 10 Jan 2024 11:02:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704913320; cv=none; d=google.com; s=arc-20160816; b=Ahdg4sSLe/v0zy+1UF/b+d0WkbsceZYO67WUpl5/FGu+HuCQ/TrvgSqIxNjWyTflMd zDDkupc/B+rE+DmOwKNulvNKz/h8iGxib8wwDjcxWGVQybTLATFpxfvekZINRHFqC7fq kz7I3cS+fy/WIOIetRc+6SmG3CEiYYW4oYt+kWkJChligOVdzvRzj+6LTjHIZKbnfoRo GWAIgcearKiSVb1HHF2jgISoa0ouTYze93MDuZTnA/Byax0Euu0b790662Gl73Bx3nKF fzIXnZCtCGNh8WFZ4gJ7djtg/VGCNhsfu1HwspwhOVEWn53V+ZA29v7CO6wVq53rotgU E2Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:content-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:cc:to:references :in-reply-to:from:organization:dkim-signature; bh=pJpTNHjkrdudfIITkK7u4W2zrdtA79u2wxg+UQ854QE=; fh=gMdau9lDuxSEMg0SjFV8L8RZWfMUb12kJE1HQhVfWnk=; b=LeD7c63VACKDdE25+6R/rtUtbeYRGsDG5QC9ee+k2SZE/tvS2T3ZS9aUGqv8hRajh0 pwpGbshVe+Bbwfb3fSqIrcm6zLxytLwY80fTDVj/i4y7peY71yiSiePdmKH0bjZJaNJW l/9X293y4OEwNuIA8L0dE31EIt66XwfVyzpM+sPBLv3UOh+11iWXQucJpGahSEgL24Or AclKmmuLh8KdQwdngE8CaiDDyrmJFghX6iYYl9sutelTBOWiV3fTZyGXPyuk6giGrgyW OBkMpLn117u9bJpgxDh4tEtAlfO6pzOv3kvc1KPQnaWcMUdGxeqRSC/s5puTivmWTWPq q8tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iPFr1TpW; spf=pass (google.com: domain of linux-kernel+bounces-22627-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22627-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h17-20020a05622a171100b004298f0190aesi4684635qtk.435.2024.01.10.11.02.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 11:02:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22627-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iPFr1TpW; spf=pass (google.com: domain of linux-kernel+bounces-22627-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22627-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8A4611C22A2C for ; Wed, 10 Jan 2024 19:02:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 586B24D5B2; Wed, 10 Jan 2024 19:01:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iPFr1TpW" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 4014F4D5A1 for ; Wed, 10 Jan 2024 19:01:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704913307; 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: in-reply-to:in-reply-to:references:references; bh=pJpTNHjkrdudfIITkK7u4W2zrdtA79u2wxg+UQ854QE=; b=iPFr1TpWHNCb+VJZn3Ym4uQmka8KeE7gKPqdZg7Q0UWYLFBFGkxAgMXipXnqT+kZQnB72e SUxR0s7PteLZ7TlcwtX3c+Cb/xgVKk9MM2gghv5vzgb6y/9Oj7lfV+ces2smkaVoj9eEtF Nt4gVccblZPDJQW3QKmZoctZ4+JKN40= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-587-GkCjAoSgOlOd9KvahLP1FQ-1; Wed, 10 Jan 2024 14:01:42 -0500 X-MC-Unique: GkCjAoSgOlOd9KvahLP1FQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 270511C060E2; Wed, 10 Jan 2024 19:01:42 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 395822026F95; Wed, 10 Jan 2024 19:01:41 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <9872f991-56a8-4915-b9b0-53accd6db0ef@moroto.mountain> References: <9872f991-56a8-4915-b9b0-53accd6db0ef@moroto.mountain> To: Dan Carpenter Cc: dhowells@redhat.com, Jeff Layton , linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] netfs, fscache: Prevent Oops in fscache_put_cache() 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-ID: <1788107.1704913300.1@warthog.procyon.org.uk> Date: Wed, 10 Jan 2024 19:01:40 +0000 Message-ID: <1788108.1704913300@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 Dan Carpenter wrote: > zero = __refcount_dec_and_test(&cache->ref, &ref); > - trace_fscache_cache(debug_id, ref - 1, where); > + trace_fscache_cache(cache->debug_id, ref - 1, where); You can't do that if !zero. cache may be deallocated between the two lines. David