Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp804159rdb; Fri, 17 Nov 2023 13:18:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8ikSCpaeXciGrUhy3tZ5hvW+uifR/B5BGc7RK1fFy8bKJ+Hx4/CfGANy5CW1545qeu5iY X-Received: by 2002:a05:6808:3a0e:b0:3b6:cb4b:4799 with SMTP id gr14-20020a0568083a0e00b003b6cb4b4799mr703569oib.56.1700255881727; Fri, 17 Nov 2023 13:18:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700255881; cv=none; d=google.com; s=arc-20160816; b=KGEsfnXBWT85ZwhkwizPJT/84ixyufud4si6Dvti3i0s9KZb2zDp9xILlne7jmkVWR eEhASA0mMUryYE52jq4XteMMJaN4+W6GGIcyZrBG8triKe1eZ5m+gUf9ToDXnFTQTxEJ XYZB0YYyhvbRXi+Btyy9HavzaGUhvi3pG/Y9FmbymS9edJTqTw0C6yHaZOM2m19UqcQJ aDsTZPxgT+fIQ1qR6fMzk1q9oZw/tO+PcRfQ9AXuMJappK9B1aHPzcWyRzcSEO8aFY64 D9oyIONRVBF907BBmuWWFXhfSGMEeegxajFryijTr8JDCHuEMCN1W69wwK6ZqGp+/BXk ZSjA== 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=lVY/c7gYUTDnyYYKKvGQU3Q29dA69hck6eN/HP5dBQ0=; b=TcWM7rzADmIpRTaQnddoxDSbz3j6wUD64wyQCwk0nr6jNMpBp9BZsVau2BJA573zen aZvjz+wG8KhpT7IHOYwacDydF6cKh8FjHWtUJg3GZn7nBySqfLUmTbcp949Ax0hAP4ur z7ewcOTGdwxkojFkPTRhc15G90i1rWHiiBizErmKbGlY04Q+L9RO/3+vby132DQ0QV90 gCjwo9j4tjCqzqtMhaIMfo+QDydTPemj0k0XWEweSszMmsiY2BcxAd5Efj5XLu4Q/pst JgcXThiRVzkufwOwqKAl7MjKSTlvbesHOZiMg886/gDQfAaWXKYjcc+ZUoGTiwvPZzUU 3bYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R1hbXlTy; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-nfs-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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 1-20020a631041000000b005bdd76219edsi2452071pgq.675.2023.11.17.13.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 13:18:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R1hbXlTy; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-nfs-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 5699D82BB54F; Fri, 17 Nov 2023 13:18:00 -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 S1346234AbjKQVRx (ORCPT + 99 others); Fri, 17 Nov 2023 16:17:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235818AbjKQVRX (ORCPT ); Fri, 17 Nov 2023 16:17:23 -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 303842686 for ; Fri, 17 Nov 2023 13:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700255811; 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=R1hbXlTyyK0wVh8WFteNzri5UNUu04TB58Xk8XhL5PUCMTofC5dZFT1VCfTQF95+qfL7bt gWcWeVmkEQy5m2sy2/iLFtqLuDQ0aR0Smhszczh+FVVQNnlmg1oHLQwjpMtxMospY9DSHK hdqOAphMwehkVad/EKb6CJBZH66OYFg= 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-86-rHs7fDMYPGmnOtXv9QHMRA-1; Fri, 17 Nov 2023 16:16:47 -0500 X-MC-Unique: rHs7fDMYPGmnOtXv9QHMRA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 9122C1C06361; Fri, 17 Nov 2023 21:16:46 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2A8040C6EBB; Fri, 17 Nov 2023 21:16:43 +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 , 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 v2 17/51] netfs: Make netfs_put_request() handle a NULL pointer Date: Fri, 17 Nov 2023 21:15:09 +0000 Message-ID: <20231117211544.1740466-18-dhowells@redhat.com> In-Reply-To: <20231117211544.1740466-1-dhowells@redhat.com> References: <20231117211544.1740466-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 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_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 17 Nov 2023 13:18:00 -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); + } } } }