lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f16b2dc1c2fa50cb557b39a9ef83bf83ea6279b5.camel@hammerspace.com>
Date:   Wed, 20 Oct 2021 19:04:35 +0000
From:   Trond Myklebust <trondmy@...merspace.com>
To:     "trbecker@...il.com" <trbecker@...il.com>,
        "linux-nfs@...r.kernel.org" <linux-nfs@...r.kernel.org>
CC:     "tbecker@...hat.com" <tbecker@...hat.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "chuck.lever@...cle.com" <chuck.lever@...cle.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "bfields@...ldses.org" <bfields@...ldses.org>,
        "anna.schumaker@...app.com" <anna.schumaker@...app.com>
Subject: Re: [PATCH] sunrpc: bug on rpc_task_set_client when no client is
 present.

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@...il.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@...merspace.com


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ