Просмотр исходного кода

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>
Alex Ng 10 лет назад
Родитель
Сommit
e66853b090
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      drivers/hv/hv_utils_transport.c

+ 3 - 0
drivers/hv/hv_utils_transport.c

@@ -310,6 +310,9 @@ struct hvutil_transport *hvutil_transport_init(const char *name,
 	return hvt;
 	return hvt;
 
 
 err_free_hvt:
 err_free_hvt:
+	spin_lock(&hvt_list_lock);
+	list_del(&hvt->list);
+	spin_unlock(&hvt_list_lock);
 	kfree(hvt);
 	kfree(hvt);
 	return NULL;
 	return NULL;
 }
 }