Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1948073rdb; Thu, 7 Dec 2023 13:26:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2+pRY0oP3JBcn91Hx3dEhYchj7HCHzjgLcGP4XTNWhkNsZapPbyY/cWcTkCU5cC77iHtE X-Received: by 2002:a17:902:d483:b0:1d0:5431:869 with SMTP id c3-20020a170902d48300b001d054310869mr3195754plg.8.1701984381004; Thu, 07 Dec 2023 13:26:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701984380; cv=none; d=google.com; s=arc-20160816; b=NLlMc9PSMmdmPxRhynhq9t4917rfIUa4PXfC1MO9SSsl9MjZmNj6JbQF3EUf32B+ry k1HoSBVgTXARN1TMSpl4/+kR5pT5+dbTp6qfWK95/JGR7dOKm1aZE7Q0MSbyrjdttdfv zGx+iIEBFV+7XOqokwW1tnuN29Yp+Vc0kHbd5+ET+yYFbG3oOnqBdLrXQSVSHDQveghV V4XDSLps+hPH7/YAO3Vtj8N6WoWBvM5vxW1LXrNWajuUNIICsEFXCqPDqrHCANCADbCt JRDlDtf5kUQOPKiri1pVnYEck96guhUPYfKAsG9+3iVNHG7wR3Ghc8HDEKHVq0FY8n86 DR8g== 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=TplKnEM+yEPEbo0nhpc7pyyOPUTPDiv/+QmUHY4pPf61rBuk5ZaLA02C+dLHhhhaRe Jwwk0ZuiC7GaLRtzTndfR7/8uegfxFPHrsHlF6eLNH7z7REG6vJFq6VbOHHlsKpYhwQ5 lyaj4KFSrL+TIjNAqRQoWsqkFWrT0elEAwCJ4sKOeRegT9yCce9aCeJQHkiXSJWKTvIC tSUcvci7lTtw8aD9OQKJfjqYRE1lCmzYWAn8xd7TqNd2Alz4U/Ls81OQkLOoucWp/Jud h9dyqz3M+JaHpziRtK3Fdp9JOjvmSNIZ6KBIrYh6bx23iiNMoNFBpiqXWYca7Ujb7Ddb DZLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GHfSIc9S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h14-20020a170902f54e00b001d00a56b03asi367525plf.337.2023.12.07.13.26.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 13:26:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=GHfSIc9S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 10D9480A91BD; Thu, 7 Dec 2023 13:26:20 -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 S229738AbjLGV0H (ORCPT + 99 others); Thu, 7 Dec 2023 16:26:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235372AbjLGVY4 (ORCPT ); Thu, 7 Dec 2023 16:24:56 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A967B1FF1 for ; Thu, 7 Dec 2023 13:23:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701984209; 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=GHfSIc9SUFqyhKLfo7XtAG+IZKjNbZuLzh24e8BlrSqgYM+LkOTLmr4Q5GpGpaYpbZDssq 4i/W+llN8hIYItn9kOqv4OQvAxrH+gYp0rVkHoI3jRO3loNGr5Dg9B9nVND8nh8N1ogHae rTDd0UCiOlmrj7sKd9znT9nei5dIzm0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-613-_pwwI_YRN4GTpksMjMzvlA-1; Thu, 07 Dec 2023 16:23:25 -0500 X-MC-Unique: _pwwI_YRN4GTpksMjMzvlA-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 6D04410B9340; Thu, 7 Dec 2023 21:23:24 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4FB72026D66; Thu, 7 Dec 2023 21:23: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 v3 21/59] netfs: Make netfs_put_request() handle a NULL pointer Date: Thu, 7 Dec 2023 21:21:28 +0000 Message-ID: <20231207212206.1379128-22-dhowells@redhat.com> In-Reply-To: <20231207212206.1379128-1-dhowells@redhat.com> References: <20231207212206.1379128-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 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_H4,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]); Thu, 07 Dec 2023 13:26:20 -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); + } } } }