Message ID | 356fb42c-9cf1-45cd-9233-ac845c507fb7@moroto.mountain |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp371903vqb; Wed, 11 Oct 2023 01:01:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPXIVKnPKBHHuy6nL0RPceq53RU8ODRsk1A7ev5aj6G25cg1+iJVtHPTbaX35sWaahoEbO X-Received: by 2002:a05:6a21:197:b0:14e:2c56:7b02 with SMTP id le23-20020a056a21019700b0014e2c567b02mr25941939pzb.0.1697011264805; Wed, 11 Oct 2023 01:01:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697011264; cv=none; d=google.com; s=arc-20160816; b=zhcIwS5o9Zpk1hxdTmfLKV53SQb1zI9Of72EVDM5TBNEs6pZ+qiYpd15ydUPRQmcCR yNpnWSK28uhbUBJcp8KRwobNy6+aZXlPtfmddbfF2a7osbzV1UyHUUx4G7iPLwhDzG8J ASUS4RFhZhlff8TQoxlNXPRw3PaTj1xp7KgfCai+VOBhiZqIZX3TstGWR/0yF/S3j8UQ 3LSBVVre0QesJsB8guGYkXce3Gtu5sFdBEZZvFN1VYyoX4gq6+C1lXIB+hGjJUiVVoE/ EVkW2ry1k5jJmPeURdlNIMT0oGdPSiKl4qvjnQw6VAz7WYHCKJqesj2g8PVJcKD2dt4/ /R6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=qz8ZijtXypgZfgGaNG42ozEudQwZ/S4uYiYC3qrkT4w=; fh=2xSIjrOr8i2m0IflK7GIO2DFFUF5JAjPrkT7MNZ3GNc=; b=Iq5ZZk6BJaJkxBHojYDNnhlV5yRbvjInxTaIqFhV9+VCxAOh/Y/+VV1jMfKA5BQNiw h9QcIACDa4RvM7On0H448WHSwsUlGqBKhD4C9/yCQjp/P5WfBjITyaa9t7DAP/nFXw3F eNQyjhNJgI+mzyWuNzPkbG3/6X+0MO2KWxjWRYPQ/La/CirRHz1d7G67ApR7BzYhielB MoNlz2Q0vKbHJbulRt5VZLKexyT5a7M+nicsQOsOifVaZXQh4GzzVtu74eIHyIY45oYf gZDVEXRG+ypKBxqxnGTLUN4//SklGtHIx4y+HvtboLaUs0agVlqERKn1FVaEmdbzmr7d BwXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="InioOG/M"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id cp12-20020a170902e78c00b001c5cf1c30cfsi13045615plb.435.2023.10.11.01.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 01:01:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="InioOG/M"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id EE6088054B55; Wed, 11 Oct 2023 01:00:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345542AbjJKIAe (ORCPT <rfc822;rua109.linux@gmail.com> + 19 others); Wed, 11 Oct 2023 04:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345393AbjJKIAb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 11 Oct 2023 04:00:31 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A9B59D for <linux-kernel@vger.kernel.org>; Wed, 11 Oct 2023 01:00:28 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3231dff4343so382363f8f.0 for <linux-kernel@vger.kernel.org>; Wed, 11 Oct 2023 01:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697011226; x=1697616026; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=qz8ZijtXypgZfgGaNG42ozEudQwZ/S4uYiYC3qrkT4w=; b=InioOG/MLYTDZA2VHIziYLynQlDASgEG+NsTSePgf3hOroOP5kj0NKANmiB5gbdz12 aIqTEaXK9XQNielWD5T8+sDPokI4KknFTR4RhtYHpUTFyXbbWiNwjL10mDh9FayHngzC iJGDxFBD7rnAKMz+WEndq+J7kc7cBGiF5fDYBTf2+oVPrZO15w3ZR5yfLEuDhGzahH8U LfhzXgdZtv2kBprW7uywpeluZ/vBjFoqKC1uTHr3QECeMV0y4DLIzLAgUc04sQ9XLjH1 cz7aU9n/QBmMqNQ0w07ct+mqhcyCzgq6shmHSr2+LjQZth2g0ux3L12ooRYkqFohFRUj YgHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697011226; x=1697616026; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qz8ZijtXypgZfgGaNG42ozEudQwZ/S4uYiYC3qrkT4w=; b=ebfPlUcGH6LgBqOpwmSfWtNPKlUwAU0OOyVJhqVBqiMqqIXsGOvLqJ8Z+hbzkeKc65 H2aS+0onyihTP4J/sn6lNNCk2XSztxLa+ARVrjlnm94F7p8HfsM+LUlaW4CinaRUBfnC qmevhIQZKCYd6RkvD8UOK/A0YT9F7A2yv+oCfoDkLnM0x+AA5qXwzxWNcGc2PyBPOjhN PFx2puNqzBN2z6QKi6XNqzVf2ZbKaJ3Ciw3TCSg8zz0XWAyTbpsZ6nZ4VeaaxkOAfHMs eHbKGbSZZ2o7HEypSvVw0vmjCYk71XUK4/LzRq8gh6+hjM4vvpl2HjKkmEy4FjZucD9B UEkw== X-Gm-Message-State: AOJu0YxecCWZvXxRx45/rqdmr2eV0fm9lXCI9S+RulGmFrVJhEddGfeD Cr84+nkf9DZ4K0WtNlTxDod/yg== X-Received: by 2002:a05:6000:243:b0:329:6b53:e3ad with SMTP id m3-20020a056000024300b003296b53e3admr12254266wrz.34.1697011226548; Wed, 11 Oct 2023 01:00:26 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id l9-20020a1c7909000000b00401b242e2e6sm18282714wme.47.2023.10.11.01.00.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 01:00:26 -0700 (PDT) Date: Wed, 11 Oct 2023 11:00:22 +0300 From: Dan Carpenter <dan.carpenter@linaro.org> To: Xiyu Yang <xiyuyang19@fudan.edu.cn> Cc: Chuck Lever <chuck.lever@oracle.com>, Jeff Layton <jlayton@kernel.org>, Neil Brown <neilb@suse.de>, Olga Kornievskaia <kolga@netapp.com>, Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>, Trond Myklebust <trond.myklebust@hammerspace.com>, Anna Schumaker <anna@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, "J. Bruce Fields" <bfields@fieldses.org>, Xin Tan <tanxin.ctf@gmail.com>, linux-nfs@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH net-XXX] SUNRPC: Add an IS_ERR() check back to where it was Message-ID: <356fb42c-9cf1-45cd-9233-ac845c507fb7@moroto.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 11 Oct 2023 01:00:51 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779445284092286893 X-GMAIL-MSGID: 1779445284092286893 |
Series |
[net-XXX] SUNRPC: Add an IS_ERR() check back to where it was
|
|
Commit Message
Dan Carpenter
Oct. 11, 2023, 8 a.m. UTC
This IS_ERR() check was deleted during in a cleanup because, at the time,
the rpcb_call_async() function could not return an error pointer. That
changed in commit 25cf32ad5dba ("SUNRPC: Handle allocation failure in
rpc_new_task()") and now it can return an error pointer. Put the check
back.
A related revert was done in commit 13bd90141804 ("Revert "SUNRPC:
Remove unreachable error condition"").
Fixes: 037e910b52b0 ("SUNRPC: Remove unreachable error condition in rpcb_getport_async()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
It's possible Smatch was responsible for generating the original warning
because it warns for unnecessary NULL checks. But generally, there was
a future error pointer implied. Those warnings are just a hint, not a
command.
net/sunrpc/rpcb_clnt.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
Obviously net-XXX is not what I intended. This applies to the nfs tree I think. regards, dan carpenter
On Wed, Oct 11, 2023 at 11:00:22AM +0300, Dan Carpenter wrote: > This IS_ERR() check was deleted during in a cleanup because, at the time, > the rpcb_call_async() function could not return an error pointer. That > changed in commit 25cf32ad5dba ("SUNRPC: Handle allocation failure in > rpc_new_task()") and now it can return an error pointer. Put the check > back. > > A related revert was done in commit 13bd90141804 ("Revert "SUNRPC: > Remove unreachable error condition""). > > Fixes: 037e910b52b0 ("SUNRPC: Remove unreachable error condition in rpcb_getport_async()") > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Thanks, I've reviewed the logic of this commit along with the description and it matches up in my mind. Reviewed-by: Simon Horman <horms@kernel.org>
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 5988a5c5ff3f..102c3818bc54 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c @@ -769,6 +769,10 @@ void rpcb_getport_async(struct rpc_task *task) child = rpcb_call_async(rpcb_clnt, map, proc); rpc_release_client(rpcb_clnt); + if (IS_ERR(child)) { + /* rpcb_map_release() has freed the arguments */ + return; + } xprt->stat.bind_count++; rpc_put_task(child);