linux-stable/drivers/hv
Andrea Parri (Microsoft) c9947957cc Drivers: hv: vmbus: Fix handling of messages with transaction ID of zero
[ Upstream commit 82cd4bacff ]

vmbus_request_addr() returns 0 (zero) if the transaction ID passed
to as argument is 0.  This is unfortunate for two reasons: first,
netvsc_send_completion() does not check for a NULL cmd_rqst (before
dereferencing the corresponding NVSP message); second, 0 is a *valid*
value of cmd_rqst in netvsc_send_tx_complete(), cf. the call of
vmbus_sendpacket() in netvsc_send_pkt().

vmbus_request_addr() has included the code in question since its
introduction with commit e8b7db3844 ("Drivers: hv: vmbus: Add
vmbus_requestor data structure for VMBus hardening"); such code was
motivated by the early use of vmbus_requestor by hv_storvsc.  Since
hv_storvsc moved to a tag-based mechanism to generate and retrieve
transaction IDs with commit bf5fd8cae3 ("scsi: storvsc: Use
blk_mq_unique_tag() to generate requestIDs"), vmbus_request_addr()
can be modified to return VMBUS_RQST_ERROR if the ID is 0.  This
change solves the issues in hv_netvsc (and makes the handling of
messages with transaction ID of 0 consistent with the semantics
"the ID is not contained in the requestor/invalid ID").

vmbus_next_request_id(), vmbus_request_addr() should still reserve
the ID of 0 for Hyper-V, because Hyper-V will "ignore" (not respond
to) VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED packets/requests with
transaction ID of 0 from the guest.

Fixes: bf5fd8cae3 ("scsi: storvsc: Use blk_mq_unique_tag() to generate requestIDs")
Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20220419122325.10078-2-parri.andrea@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-09 10:26:03 +02:00
..
Kconfig hv: utils: add PTP_1588_CLOCK to Kconfig to fix build 2021-11-28 21:22:35 +00:00
Makefile Drivers: hv: Move Hyper-V extended capability check to arch neutral code 2021-06-05 10:22:34 +00:00
channel.c Drivers: hv: vmbus: Fix handling of messages with transaction ID of zero 2022-06-09 10:26:03 +02:00
channel_mgmt.c Drivers: hv: vmbus: Replace smp_store_mb() with virt_store_mb() 2022-04-13 19:27:41 +02:00
connection.c Drivers: hv: vmbus: Add SNP support for VMbus channel initiate message 2021-10-28 11:22:55 +00:00
hv.c x86/hyperv: Add ghcb hvcall support for SNP VM 2021-10-28 11:22:49 +00:00
hv_balloon.c Drivers: hv: balloon: Disable balloon and hot-add accordingly 2022-04-20 09:36:22 +02:00
hv_common.c Drivers: hv: vmbus: Propagate VMbus coherence to each VMbus device 2022-04-20 09:36:20 +02:00
hv_debugfs.c
hv_fcopy.c Drivers: hv: vmbus: Copy packets sent by Hyper-V out of the ring buffer 2021-05-14 17:37:46 +00:00
hv_kvp.c Drivers: hv: vmbus: Copy packets sent by Hyper-V out of the ring buffer 2021-05-14 17:37:46 +00:00
hv_snapshot.c hv_utils: Set the maximum packet size for VSS driver to the length of the receive buffer 2021-08-25 19:03:20 +00:00
hv_trace.c
hv_trace.h Drivers: hv: vmbus: Drivers: hv: vmbus: Introduce CHANNELMSG_MODIFYCHANNEL_RESPONSE 2021-04-18 13:03:11 +00:00
hv_trace_balloon.h
hv_util.c drivers: hv: Decouple Hyper-V clock/timer code from VMbus drivers 2021-07-19 09:24:28 +00:00
hv_utils_transport.c Drivers: hv: utils: Make use of the helper macro LIST_HEAD() 2022-02-09 14:33:21 +00:00
hv_utils_transport.h
hyperv_vmbus.h hyperv-next for 5.16 2021-11-02 10:56:49 -07:00
ring_buffer.c Drivers: hv: vmbus: Prevent load re-ordering when reading ring buffer 2022-04-20 09:36:20 +02:00
vmbus_drv.c Drivers: hv: vmbus: Propagate VMbus coherence to each VMbus device 2022-04-20 09:36:20 +02:00