[dm-devel] [PATCH 15/16] multipathd: fix broken pthread cleanup in fpin_fabric_notification_receiver()

mwilck at suse.com mwilck at suse.com
Thu Sep 1 16:09:51 UTC 2022


From: Martin Wilck <mwilck at suse.com>

We were returning from a phtread-cancel block. That should be avoided.

Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 multipathd/fpin_handlers.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/multipathd/fpin_handlers.c b/multipathd/fpin_handlers.c
index a7da2c9..03b2b9a 100644
--- a/multipathd/fpin_handlers.c
+++ b/multipathd/fpin_handlers.c
@@ -499,13 +499,14 @@ void *fpin_fabric_notification_receiver(__attribute__((unused))void *unused)
 	rcu_register_thread();
 
 	pthread_cleanup_push(receiver_cleanup_list, NULL);
+	pthread_cleanup_push(cleanup_fd_ptr, &fd);
+
 	fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_SCSITRANSPORT);
 	if (fd < 0) {
 		condlog(0, "fc socket error %d", fd);
-		return NULL;
+		goto out;
 	}
 
-	pthread_cleanup_push(cleanup_fd_ptr, &fd);
 	memset(&fc_local, 0, sizeof(fc_local));
 	fc_local.nl_family = AF_NETLINK;
 	fc_local.nl_groups = ~0;
-- 
2.37.1



More information about the dm-devel mailing list