Commit a760d638 authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Mauro Carvalho Chehab

[media] lmedm04: don't write to buffer without a mutex

usb_buffer not inside mutex lock, waiting caller can alter buffer.
 Static added to lme2510_exit and lme2510_exit_int.
Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 853e3b29
...@@ -169,14 +169,14 @@ static int lme2510_usb_talk(struct dvb_usb_device *d, ...@@ -169,14 +169,14 @@ static int lme2510_usb_talk(struct dvb_usb_device *d,
} }
buff = st->usb_buffer; buff = st->usb_buffer;
/* the read/write capped at 512 */
memcpy(buff, wbuf, (wlen > 512) ? 512 : wlen);
ret = mutex_lock_interruptible(&d->usb_mutex); ret = mutex_lock_interruptible(&d->usb_mutex);
if (ret < 0) if (ret < 0)
return -EAGAIN; return -EAGAIN;
/* the read/write capped at 512 */
memcpy(buff, wbuf, (wlen > 512) ? 512 : wlen);
ret |= usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, 0x01)); ret |= usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, 0x01));
ret |= lme2510_bulk_write(d->udev, buff, wlen , 0x01); ret |= lme2510_bulk_write(d->udev, buff, wlen , 0x01);
...@@ -1247,7 +1247,7 @@ static struct dvb_usb_device_properties lme2510c_properties = { ...@@ -1247,7 +1247,7 @@ static struct dvb_usb_device_properties lme2510c_properties = {
} }
}; };
void *lme2510_exit_int(struct dvb_usb_device *d) static void *lme2510_exit_int(struct dvb_usb_device *d)
{ {
struct lme2510_state *st = d->priv; struct lme2510_state *st = d->priv;
struct dvb_usb_adapter *adap = &d->adapter[0]; struct dvb_usb_adapter *adap = &d->adapter[0];
...@@ -1274,7 +1274,7 @@ void *lme2510_exit_int(struct dvb_usb_device *d) ...@@ -1274,7 +1274,7 @@ void *lme2510_exit_int(struct dvb_usb_device *d)
return buffer; return buffer;
} }
void lme2510_exit(struct usb_interface *intf) static void lme2510_exit(struct usb_interface *intf)
{ {
struct dvb_usb_device *d = usb_get_intfdata(intf); struct dvb_usb_device *d = usb_get_intfdata(intf);
void *usb_buffer; void *usb_buffer;
...@@ -1316,5 +1316,5 @@ module_exit(lme2510_module_exit); ...@@ -1316,5 +1316,5 @@ module_exit(lme2510_module_exit);
MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0");
MODULE_VERSION("1.84"); MODULE_VERSION("1.85");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment