From 8be59045eae5fbbd85acf13614b9300e0d1cb779 Mon Sep 17 00:00:00 2001 From: Weiguo Li Date: Thu, 17 Feb 2022 01:50:47 +0800 Subject: [PATCH] thread: fix double unlock in spdk_io_device_register Since there is a pthread_mutex_unlock() in normal condition, another pthread_mutex_unlock() in the "tmp != NULL" branch should be removed, otherwise will cause a double unlock. Fixes issue #2378. Signed-off-by: Weiguo Li Change-Id: I6c80a9527dd60e0b7c1d3c54b6da371b31118f02 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11642 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris Reviewed-by: Aleksey Marchuk Tested-by: SPDK CI Jenkins --- lib/thread/thread.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/thread/thread.c b/lib/thread/thread.c index b1ebba01f..841c8be52 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -1992,7 +1992,6 @@ spdk_io_device_register(void *io_device, spdk_io_channel_create_cb create_cb, if (tmp != NULL) { SPDK_ERRLOG("io_device %p already registered (old:%s new:%s)\n", io_device, tmp->name, dev->name); - pthread_mutex_unlock(&g_devlist_mutex); free(dev); }