[PATCH] rdma: Fix dtr_path use-after-free

"zhengbing.huang" <[email protected]>
Newsgroups dev.linux.lists.drbd-dev
Message-ID <[email protected]>
From: Chen Fan <[email protected]>

Commit 60a63d648863 has removed for_each_path_ref in rdma,
however in 'for_each_path_ref' it would get-ref for path
after find a path, it will be ok after dtr_activate_path
return error and put-ref for path, but at present if
dtr_activate_path return error, it calls put-ref free
drbd_path directly.

Signed-off-by: Chen Fan <[email protected]>
---
 drbd/drbd_transport_rdma.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drbd/drbd_transport_rdma.c b/drbd/drbd_transport_rdma.c
index 65454bac6..3eb8cf39c 100644
--- a/drbd/drbd_transport_rdma.c
+++ b/drbd/drbd_transport_rdma.c
@@ -2970,7 +2970,6 @@ static int dtr_prepare_connect(struct drbd_transport *transport)
 	list_for_each_entry(path, &transport->paths, path.list) {
 		err = dtr_activate_path(path);
 		if (err) {
-			kref_put(&path->path.kref, drbd_destroy_path);
 			goto abort;
 		}
 	}
-- 
2.17.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.