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

zhengbing.huang zhengbing.huang at easystack.cn
Tue Jun 11 13:14:06 CEST 2024


From: Chen Fan <fan.chen at easystack.cn>

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 <fan.chen at easystack.cn>
---
 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



More information about the drbd-dev mailing list