summaryrefslogtreecommitdiffstats
path: root/drivers/hv/hv_utils_transport.c
diff options
context:
space:
mode:
authorAlex Ng <alexng@microsoft.com>2016-02-26 15:13:20 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-01 16:57:20 -0800
commite66853b09017a788dc384dadce9323396dae3293 (patch)
tree688ec5a79a32f23aad154b8f2d9d34109e0a4985 /drivers/hv/hv_utils_transport.c
parentb9830d120cbe155863399f25eaef6aa8353e767f (diff)
downloadlinux-stable-e66853b09017a788dc384dadce9323396dae3293.tar.gz
linux-stable-e66853b09017a788dc384dadce9323396dae3293.tar.bz2
linux-stable-e66853b09017a788dc384dadce9323396dae3293.zip
Drivers: hv: utils: Remove util transport handler from list if registration fails
If util transport fails to initialize for any reason, the list of transport handlers may become corrupted due to freeing the transport handler without removing it from the list. Fix this by cleaning it up from the list. Signed-off-by: Alex Ng <alexng@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv/hv_utils_transport.c')
-rw-r--r--drivers/hv/hv_utils_transport.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hv/hv_utils_transport.c b/drivers/hv/hv_utils_transport.c
index 4f42c0e20c20..9a9983fa4531 100644
--- a/drivers/hv/hv_utils_transport.c
+++ b/drivers/hv/hv_utils_transport.c
@@ -310,6 +310,9 @@ struct hvutil_transport *hvutil_transport_init(const char *name,
return hvt;
err_free_hvt:
+ spin_lock(&hvt_list_lock);
+ list_del(&hvt->list);
+ spin_unlock(&hvt_list_lock);
kfree(hvt);
return NULL;
}