[PATCH 0/5] rds: trivial patches

DORMANTno replies

3 messages, 1 author, 2017-03-27 · open the first message on its own page

[PATCH 0/5] rds: trivial patches

From: Zhu Yanjun <hidden>
Date: 2017-03-27 07:07:46

Hi, all 

The 5 patches are trivial patches.

Thanks a lot.

Zhu Yanjun (5):
  rds: tcp: release the created connection
  rds: rdma: fix memory leak error
  rds: remove unnecessary returned value check
  rds: remove the unused variable
  rds: ib: add the static type to the functions

 net/rds/af_rds.c     |  5 +----
 net/rds/ib_mr.h      |  2 --
 net/rds/ib_rdma.c    | 12 +++++-------
 net/rds/ib_recv.c    |  3 +--
 net/rds/rdma.c       |  7 +++++++
 net/rds/rds.h        |  2 +-
 net/rds/stats.c      |  3 +--
 net/rds/tcp_listen.c |  1 +
 8 files changed, 17 insertions(+), 18 deletions(-)

-- 
2.7.4

[PATCH 4/5] rds: remove the unused variable

From: Zhu Yanjun <hidden>
Date: 2017-03-27 07:07:03

In the function rds_ib_recv_path, the variable ret is not used.

Signed-off-by: Zhu Yanjun <redacted>
---
 net/rds/ib_recv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index e10624a..be8d2f2 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -1023,7 +1023,6 @@ int rds_ib_recv_path(struct rds_conn_path *cp)
 {
 	struct rds_connection *conn = cp->cp_conn;
 	struct rds_ib_connection *ic = conn->c_transport_data;
-	int ret = 0;
 
 	rdsdebug("conn %p\n", conn);
 	if (rds_conn_up(conn)) {
@@ -1031,7 +1030,7 @@ int rds_ib_recv_path(struct rds_conn_path *cp)
 		rds_ib_recv_refill(conn, 0, GFP_KERNEL);
 	}
 
-	return ret;
+	return 0;
 }
 
 int rds_ib_recv_init(void)
-- 
2.7.4

[PATCH 2/5] rds: rdma: fix memory leak error

From: Zhu Yanjun <hidden>
Date: 2017-03-27 07:07:26

In the function __rds_rdma_map, the allocated memory and other
resources should be freed when some error occurs.

Signed-off-by: Zhu Yanjun <redacted>
---
 net/rds/rdma.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index f06fac4..ad9b6bd 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -253,6 +253,8 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,
 	sg = kcalloc(nents, sizeof(*sg), GFP_KERNEL);
 	if (!sg) {
 		ret = -ENOMEM;
+		for (i = 0; i < nents; i++)
+			put_page(pages[i]);
 		goto out;
 	}
 	WARN_ON(!nents);
@@ -293,6 +295,11 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,
 		*cookie_ret = cookie;
 
 	if (args->cookie_addr && put_user(cookie, (u64 __user *)(unsigned long) args->cookie_addr)) {
+		for (i = 0; i < nents; i++)
+			put_page(sg_page(&sg[i]));
+		kfree(sg);
+		mr->r_trans->free_mr(mr->r_trans_private, 1);
+		mr->r_trans_private = NULL;
 		ret = -EFAULT;
 		goto out;
 	}
-- 
2.7.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help