From: Trond Myklebust <trondmy@hammerspace.com>
To: "trbecker@gmail.com" <trbecker@gmail.com>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Cc: "tbecker@redhat.com" <tbecker@redhat.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"chuck.lever@oracle.com" <chuck.lever@oracle.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"kuba@kernel.org" <kuba@kernel.org>,
"bfields@fieldses.org" <bfields@fieldses.org>,
"anna.schumaker@netapp.com" <anna.schumaker@netapp.com>
Subject: Re: [PATCH] sunrpc: bug on rpc_task_set_client when no client is present.
Date: Wed, 20 Oct 2021 19:04:35 +0000 [thread overview]
Message-ID: <f16b2dc1c2fa50cb557b39a9ef83bf83ea6279b5.camel@hammerspace.com> (raw)
In-Reply-To: <20211018123812.71482-1-trbecker@gmail.com>
On Mon, 2021-10-18 at 09:38 -0300, Thiago Rafael Becker wrote:
> If we pass a NULL client to rpc_task_set_client and no client is
> attached to the task, then the kernel will crash later. Antecipate
> the
> crash by checking if a client is available for the task.
>
> Signed-off-by: Thiago Rafael Becker <trbecker@gmail.com>
> ---
> net/sunrpc/clnt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index f056ff931444..ccbc9a9715da 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -1076,7 +1076,7 @@ void rpc_task_set_transport(struct rpc_task
> *task, struct rpc_clnt *clnt)
> static
> void rpc_task_set_client(struct rpc_task *task, struct rpc_clnt
> *clnt)
> {
> -
> + BUG_ON(clnt == NULL && task->tk_client == NULL);
> if (clnt != NULL) {
> rpc_task_set_transport(task, clnt);
> task->tk_client = clnt;
I'm not seeing the point of this BUG_ON(). Why not just change this
code to not check for clnt == NULL, and let the thing Oops when it
tries to dereference clnt?
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
next prev parent reply other threads:[~2021-10-20 19:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 12:38 [PATCH] sunrpc: bug on rpc_task_set_client when no client is present Thiago Rafael Becker
2021-10-20 19:04 ` Trond Myklebust [this message]
2021-10-20 20:20 ` Thiago Rafael Becker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f16b2dc1c2fa50cb557b39a9ef83bf83ea6279b5.camel@hammerspace.com \
--to=trondmy@hammerspace.com \
--cc=anna.schumaker@netapp.com \
--cc=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tbecker@redhat.com \
--cc=trbecker@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox