aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-02-14 14:47:57 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-02-14 15:13:49 -0500
commitf9c85ee67164b37f9296eab3b754e543e4e96a1c (patch)
treea023f2d49a5e2031f63dd90d8ad628fa0f4ce83d
parent42980da2eb7eb9695d8efc0c0ef145cbbb993b2c (diff)
[media] siano: make it work again with CONFIG_VMAP_STACK
Reported as a Kaffeine bug: https://bugs.kde.org/show_bug.cgi?id=375811 The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. On Kernel 4.9, the default is to not accept DMA on stack anymore on x86 architecture. On other architectures, this has been a requirement since Kernel 2.2. So, after this patch, this driver should likely work fine on all archs. Tested with USB ID 2040:5510: Hauppauge Windham Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/usb/siano/smsusb.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c
index a4dcaec31d02..8c1f926567ec 100644
--- a/drivers/media/usb/siano/smsusb.c
+++ b/drivers/media/usb/siano/smsusb.c
@@ -218,22 +218,30 @@ static int smsusb_start_streaming(struct smsusb_device_t *dev)
218static int smsusb_sendrequest(void *context, void *buffer, size_t size) 218static int smsusb_sendrequest(void *context, void *buffer, size_t size)
219{ 219{
220 struct smsusb_device_t *dev = (struct smsusb_device_t *) context; 220 struct smsusb_device_t *dev = (struct smsusb_device_t *) context;
221 struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) buffer; 221 struct sms_msg_hdr *phdr;
222 int dummy; 222 int dummy, ret;
223 223
224 if (dev->state != SMSUSB_ACTIVE) { 224 if (dev->state != SMSUSB_ACTIVE) {
225 pr_debug("Device not active yet\n"); 225 pr_debug("Device not active yet\n");
226 return -ENOENT; 226 return -ENOENT;
227 } 227 }
228 228
229 phdr = kmalloc(size, GFP_KERNEL);
230 if (!phdr)
231 return -ENOMEM;
232 memcpy(phdr, buffer, size);
233
229 pr_debug("sending %s(%d) size: %d\n", 234 pr_debug("sending %s(%d) size: %d\n",
230 smscore_translate_msg(phdr->msg_type), phdr->msg_type, 235 smscore_translate_msg(phdr->msg_type), phdr->msg_type,
231 phdr->msg_length); 236 phdr->msg_length);
232 237
233 smsendian_handle_tx_message((struct sms_msg_data *) phdr); 238 smsendian_handle_tx_message((struct sms_msg_data *) phdr);
234 smsendian_handle_message_header((struct sms_msg_hdr *)buffer); 239 smsendian_handle_message_header((struct sms_msg_hdr *)phdr);
235 return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2), 240 ret = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2),
236 buffer, size, &dummy, 1000); 241 phdr, size, &dummy, 1000);
242
243 kfree(phdr);
244 return ret;
237} 245}
238 246
239static char *smsusb1_fw_lkup[] = { 247static char *smsusb1_fw_lkup[] = {