Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5391681rdb; Wed, 13 Dec 2023 07:27:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1mWRR2JwWvjm3q6ZeM6M4HzHcyxMO3RzMtlEq8YKLt5FauzZxFxnSF1HoIR7X4ozHGXzZ X-Received: by 2002:a17:90a:65c9:b0:286:7c79:8dc7 with SMTP id i9-20020a17090a65c900b002867c798dc7mr10369864pjs.11.1702481253617; Wed, 13 Dec 2023 07:27:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702481253; cv=none; d=google.com; s=arc-20160816; b=PUwvXB60U8jtZJk7RuLPBFPITjRRXYOw/LTV1ELbOdKKSbPiyqfzwOhSjZUa0Zf7sc KArTlON8YfMC8aPJRQZCATIDlCO6hGtRyd3rFYbhKQFNCTLq6BKrBWLcaXvEplxk2RJ6 ZD8Q/s9Da5IgufOuznjmAoTVmSNk6run5KzA9rB9BsMLbAz6wnEC9x+FFllxPsv0WdRB L8BmAAUYniUypPrILECLDFY5Z3Mc1vvgGmPRuqLmvLI+abu5NQBxLhZdb2h+pnlvkkZr eqbtL/m1bL5mGTJ9u6ekErx+p4/o/e6o7q3EcRNTN5APdbV5sGSEGnxfJfmCbm2hG2uH QmbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i1NCs1wijkp9oudHg0v3ZW2pY0xP/Retx1SxWP1fmpE=; fh=ib4gl95HfLmZdfX9QIMf3rTepWCH9JlNymcDKJTPhJg=; b=g9WrBX43Rzx9bD0IWaGV1muOPzSGmd6IKE13fJsN2Bvt5SpR6pH/IBNfjxCEM7zIT2 N+0IfW0sWRIXH8C9YCqbknj62yximFkXgWurp5v8PfZf63zNsJttlfN3Bj2KcfYFZuBD 6k3FuNlYiaI4WfGTLrt4Dfqqul/NKZROMmLnTMO1aBykNxV4Dgt+U8bafUY5BSMEHc7L vXkzGH8Uni6pQKf9NnekgiRbJRSqip4arrnNWiDEw1G5olBVYEW46bjm5mS58ewZlOta LmERsqZ3YZT1LdbsmdicNkN/oHA0QVjWZmcS7BnUOC7KKVX9t2RxY6XQfVxjmaghdQ6m 1fLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QDOO8Gtz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z3-20020a17090a1fc300b002859aae3eaasi434651pjz.66.2023.12.13.07.27.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 07:27:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QDOO8Gtz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 046238031AF1; Wed, 13 Dec 2023 07:27:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442038AbjLMP1C (ORCPT + 99 others); Wed, 13 Dec 2023 10:27:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442971AbjLMP0L (ORCPT ); Wed, 13 Dec 2023 10:26:11 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 981801BC3 for ; Wed, 13 Dec 2023 07:25:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702481133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i1NCs1wijkp9oudHg0v3ZW2pY0xP/Retx1SxWP1fmpE=; b=QDOO8GtzR0WYYlAzC2Kv0Ro5poAmEviQBh5P4EoCrAWhZrQkCVzb4oXLhNv/O8pY+yQ3Ab rRuxpFmq5IVl+gYngVGSS1OPzxtVuwXCDyqrwvrZU37CcEqZP4P0H0AfIUa70i+F7PxtYY 1Qqwq+TiGHbwT9hLakhSDVHkqnTAbbQ= 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-510-SR5-99_mNgesTFIbAUuluQ-1; Wed, 13 Dec 2023 10:25:28 -0500 X-MC-Unique: SR5-99_mNgesTFIbAUuluQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 CEA853801F6E; Wed, 13 Dec 2023 15:25:25 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 174293C2F; Wed, 13 Dec 2023 15:25:21 +0000 (UTC) From: David Howells To: Jeff Layton , Steve French Cc: David Howells , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Dominique Martinet , Eric Van Hensbergen , Ilya Dryomov , Christian Brauner , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 21/39] netfs: Make netfs_put_request() handle a NULL pointer Date: Wed, 13 Dec 2023 15:23:31 +0000 Message-ID: <20231213152350.431591-22-dhowells@redhat.com> In-Reply-To: <20231213152350.431591-1-dhowells@redhat.com> References: <20231213152350.431591-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 07:27:30 -0800 (PST) Make netfs_put_request() just return if given a NULL request pointer. Signed-off-by: David Howells cc: Jeff Layton cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/netfs/objects.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/fs/netfs/objects.c b/fs/netfs/objects.c index 7ef804e8915c..3ce6313cc5f9 100644 --- a/fs/netfs/objects.c +++ b/fs/netfs/objects.c @@ -109,19 +109,22 @@ static void netfs_free_request(struct work_struct *work) void netfs_put_request(struct netfs_io_request *rreq, bool was_async, enum netfs_rreq_ref_trace what) { - unsigned int debug_id = rreq->debug_id; + unsigned int debug_id; bool dead; int r; - dead = __refcount_dec_and_test(&rreq->ref, &r); - trace_netfs_rreq_ref(debug_id, r - 1, what); - if (dead) { - if (was_async) { - rreq->work.func = netfs_free_request; - if (!queue_work(system_unbound_wq, &rreq->work)) - BUG(); - } else { - netfs_free_request(&rreq->work); + if (rreq) { + debug_id = rreq->debug_id; + dead = __refcount_dec_and_test(&rreq->ref, &r); + trace_netfs_rreq_ref(debug_id, r - 1, what); + if (dead) { + if (was_async) { + rreq->work.func = netfs_free_request; + if (!queue_work(system_unbound_wq, &rreq->work)) + BUG(); + } else { + netfs_free_request(&rreq->work); + } } } }