summaryrefslogtreecommitdiffstats
path: root/drivers/hv
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2015-02-28 20:18:19 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-02 04:31:02 +0100
commit5b1e5b530753e660080d402b81b88684893157d5 (patch)
treef142266b9b3c12f250056a02e3653b1f86d014b8 /drivers/hv
parentDrivers: hv: vmbus: Handle both rescind and offer messages in the same context (diff)
downloadlinux-5b1e5b530753e660080d402b81b88684893157d5.tar.xz
linux-5b1e5b530753e660080d402b81b88684893157d5.zip
Drivers: hv: vmbus: Remove the channel from the channel list(s) on failure
Properly rollback state in vmbus_pocess_offer() in the failure paths. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r--drivers/hv/channel_mgmt.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index f8528e1e3a77..b1e5a5fdaf7f 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -386,7 +386,7 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
&newchannel->offermsg.offer.if_instance,
newchannel);
if (!newchannel->device_obj)
- goto err_free_chan;
+ goto err_deq_chan;
/*
* Add the new device to the bus. This will kick off device-driver
@@ -398,15 +398,26 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
pr_err("unable to add child device object (relid %d)\n",
newchannel->offermsg.child_relid);
- spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
- list_del(&newchannel->listentry);
- spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
kfree(newchannel->device_obj);
- goto err_free_chan;
+ goto err_deq_chan;
}
return;
+err_deq_chan:
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
+ list_del(&newchannel->listentry);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
+
+ if (newchannel->target_cpu != get_cpu()) {
+ put_cpu();
+ smp_call_function_single(newchannel->target_cpu,
+ percpu_channel_deq, newchannel, true);
+ } else {
+ percpu_channel_deq(newchannel);
+ put_cpu();
+ }
+
err_free_chan:
free_channel(newchannel);
}