Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Drivers: hv: util: Fix a bug in the KVP code

Add code to poll the channel since we process only one message
at a time and the host may not interrupt us. Also increase the
receive buffer size since some KVP messages are close to 8K bytes in size.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

K. Y. Srinivasan and committed by
Greg Kroah-Hartman
9bd2d0df affb1aff

+15 -4
+14 -3
drivers/hv/hv_kvp.c
··· 127 127 kvp_respond_to_host(NULL, HV_E_FAIL); 128 128 } 129 129 130 + static void poll_channel(struct vmbus_channel *channel) 131 + { 132 + if (channel->target_cpu != smp_processor_id()) 133 + smp_call_function_single(channel->target_cpu, 134 + hv_kvp_onchannelcallback, 135 + channel, true); 136 + else 137 + hv_kvp_onchannelcallback(channel); 138 + } 139 + 140 + 130 141 static int kvp_handle_handshake(struct hv_kvp_msg *msg) 131 142 { 132 143 int ret = 1; ··· 166 155 kvp_register(dm_reg_value); 167 156 kvp_transaction.active = false; 168 157 if (kvp_transaction.kvp_context) 169 - hv_kvp_onchannelcallback(kvp_transaction.kvp_context); 158 + poll_channel(kvp_transaction.kvp_context); 170 159 } 171 160 return ret; 172 161 } ··· 579 568 580 569 vmbus_sendpacket(channel, recv_buffer, buf_len, req_id, 581 570 VM_PKT_DATA_INBAND, 0); 582 - 571 + poll_channel(channel); 583 572 } 584 573 585 574 /* ··· 614 603 return; 615 604 } 616 605 617 - vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen, 606 + vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 4, &recvlen, 618 607 &requestid); 619 608 620 609 if (recvlen > 0) {
+1 -1
drivers/hv/hv_util.c
··· 319 319 (struct hv_util_service *)dev_id->driver_data; 320 320 int ret; 321 321 322 - srv->recv_buffer = kmalloc(PAGE_SIZE * 2, GFP_KERNEL); 322 + srv->recv_buffer = kmalloc(PAGE_SIZE * 4, GFP_KERNEL); 323 323 if (!srv->recv_buffer) 324 324 return -ENOMEM; 325 325 if (srv->util_init) {