1
0
Fork 0

Two fixes from Dexuan Cui:

- Fix for a (harmless) warning when building vmbus without
 CONFIG_PM_SLEEP.
  - Fix for a memory leak (and optimization) in the hyperv mouse code.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE4n5dijQDou9mhzu83qZv95d3LNwFAl2falAACgkQ3qZv95d3
 LNz/vg//VyY3jgvN2RUWUOjZA7678LRpl44myyn2soYt9K8rp1pg5FgyZIJmXTMG
 jCDUbWI/qUIeCJi7EDsb6ClKUK/FTP4qGu3P0olTXBBd7h8lHifZg5drcL7vsyqT
 P0NUVvUedtbjOUtyqAoFgNN6DhwLoOk3ZZaAd+KyRohz5wNVE6wrLRKRxVcLsVmQ
 6NijgcXazcFrH+XRUrLdduqy+80rLmVCopuelnAFdAPg311ouAs3oPmx2YMfnjSl
 z9DS3/lH+jhY9L9+ob71XZWEu9te8+2pYUT7ZL+3ztXp6ei/PJ9LVbudZWe6rWGV
 q+/juRRZSqde9b0btGdVO+CqR/8RthnytrZnEa2AmClKi4cWZS4QyeOjj4PtWuhp
 lC7oXd98a3YPRGHXcZlEnoYhYMNTWpNbHikZVYwp4olW2PrbabswfGDfERZ7shdd
 Y+tRvMXS6YPXD+Yh6aFLFTYH8sEcUg70OVVnNXfh0FSqqmW8Rmt5XLDnrkScVya6
 MsZiiwUaG8h+XGpPSeQ1zhOIhacwiDqWKjIqxxfs5xld40tqgRqM+HUbjG41T+an
 eE0xvmCwjYwYYg4WBqdx+K5ZyquQkjXwWFhOfHrkShm7MPQti/jPSPWZSQ1BBSyu
 X6CqIg9bdQrh3i2lklVFmHa//M04Q9MIjb2qAJyQC2W0AA23vEI=
 =2kWT
 -----END PGP SIGNATURE-----

Merge tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux

Pull Hyper-V fixes from Sasha Levin:
 "Two fixes from Dexuan Cui:

   - Fix a (harmless) warning when building vmbus without
     CONFIG_PM_SLEEP

   - Fix for a memory leak (and optimization) in the hyperv mouse code"

* tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
  Drivers: hv: vmbus: Fix harmless building warnings without CONFIG_PM_SLEEP
  HID: hyperv: Use in-place iterator API in the channel callback
alistair/sunxi64-5.4-dsi
Linus Torvalds 2019-10-11 10:12:45 -07:00
commit 56c642e2aa
2 changed files with 16 additions and 46 deletions

View File

@ -314,60 +314,24 @@ static void mousevsc_on_receive(struct hv_device *device,
static void mousevsc_on_channel_callback(void *context)
{
const int packet_size = 0x100;
int ret;
struct hv_device *device = context;
u32 bytes_recvd;
u64 req_id;
struct vmpacket_descriptor *desc;
unsigned char *buffer;
int bufferlen = packet_size;
buffer = kmalloc(bufferlen, GFP_ATOMIC);
if (!buffer)
return;
do {
ret = vmbus_recvpacket_raw(device->channel, buffer,
bufferlen, &bytes_recvd, &req_id);
switch (ret) {
case 0:
if (bytes_recvd <= 0) {
kfree(buffer);
return;
}
desc = (struct vmpacket_descriptor *)buffer;
switch (desc->type) {
case VM_PKT_COMP:
break;
case VM_PKT_DATA_INBAND:
mousevsc_on_receive(device, desc);
break;
default:
pr_err("unhandled packet type %d, tid %llx len %d\n",
desc->type, req_id, bytes_recvd);
break;
}
foreach_vmbus_pkt(desc, device->channel) {
switch (desc->type) {
case VM_PKT_COMP:
break;
case -ENOBUFS:
kfree(buffer);
/* Handle large packet */
bufferlen = bytes_recvd;
buffer = kmalloc(bytes_recvd, GFP_ATOMIC);
if (!buffer)
return;
case VM_PKT_DATA_INBAND:
mousevsc_on_receive(device, desc);
break;
default:
pr_err("Unhandled packet type %d, tid %llx len %d\n",
desc->type, desc->trans_id, desc->len8 * 8);
break;
}
} while (1);
}
}
static int mousevsc_connect_to_vsp(struct hv_device *device)

View File

@ -912,6 +912,7 @@ static void vmbus_shutdown(struct device *child_device)
drv->shutdown(dev);
}
#ifdef CONFIG_PM_SLEEP
/*
* vmbus_suspend - Suspend a vmbus device
*/
@ -949,6 +950,7 @@ static int vmbus_resume(struct device *child_device)
return drv->resume(dev);
}
#endif /* CONFIG_PM_SLEEP */
/*
* vmbus_device_release - Final callback release of the vmbus child device
@ -1070,6 +1072,7 @@ msg_handled:
vmbus_signal_eom(msg, message_type);
}
#ifdef CONFIG_PM_SLEEP
/*
* Fake RESCIND_CHANNEL messages to clean up hv_sock channels by force for
* hibernation, because hv_sock connections can not persist across hibernation.
@ -1105,6 +1108,7 @@ static void vmbus_force_channel_rescinded(struct vmbus_channel *channel)
vmbus_connection.work_queue,
&ctx->work);
}
#endif /* CONFIG_PM_SLEEP */
/*
* Direct callback for channels using other deferred processing
@ -2125,6 +2129,7 @@ acpi_walk_err:
return ret_val;
}
#ifdef CONFIG_PM_SLEEP
static int vmbus_bus_suspend(struct device *dev)
{
struct vmbus_channel *channel, *sc;
@ -2247,6 +2252,7 @@ static int vmbus_bus_resume(struct device *dev)
return 0;
}
#endif /* CONFIG_PM_SLEEP */
static const struct acpi_device_id vmbus_acpi_device_ids[] = {
{"VMBUS", 0},