diff mbox series

9p/net: fix memory leak in p9_client_create

Message ID 1552464097-142659-1-git-send-email-zhengbin13@huawei.com
State Not Applicable
Delegated to: David Miller
Headers show
Series 9p/net: fix memory leak in p9_client_create | expand

Commit Message

Zheng Bin March 13, 2019, 8:01 a.m. UTC
If msize is less than 4096, we should close and put trans, destroy
tagpool, not just free client. This patch fixes that.

Fixes: 574d356b7a02 ("9p/net: put a lower bound on msize")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
---
 net/9p/client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.7.4

Comments

Dominique Martinet March 13, 2019, 10:28 a.m. UTC | #1
zhengbin wrote on Wed, Mar 13, 2019:
> If msize is less than 4096, we should close and put trans, destroy
> tagpool, not just free client. This patch fixes that.
> 
> Fixes: 574d356b7a02 ("9p/net: put a lower bound on msize")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: zhengbin <zhengbin13@huawei.com>

Ack, definitely. Thanks for the fix, I'll take this for 5.1 even if it's
a bit late.

Please do Cc linux-kernel@vger.k.o next time though, that list should
get all the patches.
diff mbox series

Patch

diff --git a/net/9p/client.c b/net/9p/client.c
index 357214a..b85d51f 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1061,7 +1061,7 @@  struct p9_client *p9_client_create(const char *dev_name, char *options)
 		p9_debug(P9_DEBUG_ERROR,
 			 "Please specify a msize of at least 4k\n");
 		err = -EINVAL;
-		goto free_client;
+		goto close_trans;
 	}

 	err = p9_client_version(clnt);