[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211018123812.71482-1-trbecker@gmail.com>
Date: Mon, 18 Oct 2021 09:38:12 -0300
From: Thiago Rafael Becker <trbecker@...il.com>
To: linux-nfs@...r.kernel.org
Cc: Thiago Rafael Becker <tbecker@...hat.com>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna.schumaker@...app.com>,
"J . Bruce Fields" <bfields@...ldses.org>,
Chuck Lever <chuck.lever@...cle.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Thiago Rafael Becker <trbecker@...il.com>
Subject: [PATCH] sunrpc: bug on rpc_task_set_client when no client is present.
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;
--
2.31.1
Powered by blists - more mailing lists