linux-stable/drivers/hv
Vitaly Kuznetsov d7f2fbafb4 Drivers: hv: vmbus: serialize Offer and Rescind offer
Commit 4b2f9abea5 ("staging: hv: convert channel_mgmt.c to not call
osd_schedule_callback")' was written under an assumption that we never receive
Rescind offer while we're still processing the initial Offer request. However,
the issue we fixed in 04a258c162 could be caused by this assumption not
always being true.

In particular, we need to protect against the following:
1) Receiving a Rescind offer after we do queue_work() for processing an Offer
   request and before we actually enter vmbus_process_offer(). work.func points
   to vmbus_process_offer() at this moment and in vmbus_onoffer_rescind() we do
   another queue_work() without a check so we'll enter vmbus_process_offer()
   twice.
2) Receiving a Rescind offer after we enter vmbus_process_offer() and
   especially after we set >state = CHANNEL_OPEN_STATE. Many things can go
   wrong in that case, e.g. we can call free_channel() while we're still using
   it.

Implement the required protection by changing work->func at the very end of
vmbus_process_offer() and checking work->func in vmbus_onoffer_rescind(). In
case we receive rescind offer during or before vmbus_process_offer() is done
we set rescind flag to true and we check it at the end of vmbus_process_offer()
so such offer will not get lost.

Suggested-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-25 09:18:01 -08:00
..
channel.c Drivers: hv: rename sc_lock to the more generic lock 2015-01-25 09:18:00 -08:00
channel_mgmt.c Drivers: hv: vmbus: serialize Offer and Rescind offer 2015-01-25 09:18:01 -08:00
connection.c Drivers: hv: vmbus: Use get_cpu() to get the current CPU 2015-01-12 05:04:10 -08:00
hv.c Drivers: hv: vmbus: Implement a clockevent device 2015-01-25 09:17:57 -08:00
hv_balloon.c Drivers: hv: hv_balloon: Don't post pressure status from interrupt context 2015-01-25 09:17:57 -08:00
hv_fcopy.c hv: hv_fcopy: drop the obsolete message on transfer failure 2015-01-25 09:17:58 -08:00
hv_kvp.c Drivers: hv: kvp,vss: Fast propagation of userspace communication failure 2014-11-26 19:00:32 -08:00
hv_snapshot.c Drivers: hv: kvp,vss: Fast propagation of userspace communication failure 2014-11-26 19:00:32 -08:00
hv_util.c Drivers: hv: util: Fix a bug in the KVP code 2014-07-09 14:34:35 -07:00
hyperv_vmbus.h Drivers: hv: vmbus: Implement a clockevent device 2015-01-25 09:17:57 -08:00
Kconfig x86: Make Linux guest support optional 2013-03-04 13:14:25 -08:00
Makefile Drivers: hv: Implement the file copy service 2014-02-18 10:53:48 -08:00
ring_buffer.c Drivers: hv: vmbus: Enable interrupt driven flow control 2014-09-23 23:31:22 -07:00
vmbus_drv.c Drivers: hv: vmbus: Implement a clockevent device 2015-01-25 09:17:57 -08:00