]> git.karo-electronics.de Git - linux-beck.git/commitdiff
hv: acquire vmbus_connection.channel_mutex in vmbus_free_channels()
authorVitaly Kuznetsov <vkuznets@redhat.com>
Sat, 3 Dec 2016 20:34:32 +0000 (12:34 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Jan 2017 07:32:18 +0000 (08:32 +0100)
commit abd1026da4a7700a8db370947f75cd17b6ae6f76 upstream.

"kernel BUG at drivers/hv/channel_mgmt.c:350!" is observed when hv_vmbus
module is unloaded. BUG_ON() was introduced in commit 85d9aa705184
("Drivers: hv: vmbus: add an API vmbus_hvsock_device_unregister()") as
vmbus_free_channels() codepath was apparently forgotten.

Fixes: 85d9aa705184 ("Drivers: hv: vmbus: add an API vmbus_hvsock_device_unregister()")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/channel_mgmt.c

index 96a85cd39580a904acfdf6f57d89403c4fd734b6..1bc1d4795243a86f509b8624f9821f8d871538b5 100644 (file)
@@ -389,6 +389,7 @@ void vmbus_free_channels(void)
 {
        struct vmbus_channel *channel, *tmp;
 
+       mutex_lock(&vmbus_connection.channel_mutex);
        list_for_each_entry_safe(channel, tmp, &vmbus_connection.chn_list,
                listentry) {
                /* hv_process_channel_removal() needs this */
@@ -396,6 +397,7 @@ void vmbus_free_channels(void)
 
                vmbus_device_unregister(channel->device_obj);
        }
+       mutex_unlock(&vmbus_connection.channel_mutex);
 }
 
 /*