aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2011-04-22 05:07:40 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 08:29:26 -0400
commita760d63878b21fc16997b79e8ebee531b40c8b26 (patch)
tree2ccce950af112d9ed472202463e01575a950feb2 /drivers/media/dvb
parent853e3b2930001534b88fb36e936c9a734a79046c (diff)
[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: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-usb/lmedm04.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c
index 773638475a79..4b457e7e5d33 100644
--- a/drivers/media/dvb/dvb-usb/lmedm04.c
+++ b/drivers/media/dvb/dvb-usb/lmedm04.c
@@ -169,14 +169,14 @@ static int lme2510_usb_talk(struct dvb_usb_device *d,
169 } 169 }
170 buff = st->usb_buffer; 170 buff = st->usb_buffer;
171 171
172 /* the read/write capped at 512 */
173 memcpy(buff, wbuf, (wlen > 512) ? 512 : wlen);
174
175 ret = mutex_lock_interruptible(&d->usb_mutex); 172 ret = mutex_lock_interruptible(&d->usb_mutex);
176 173
177 if (ret < 0) 174 if (ret < 0)
178 return -EAGAIN; 175 return -EAGAIN;
179 176
177 /* the read/write capped at 512 */
178 memcpy(buff, wbuf, (wlen > 512) ? 512 : wlen);
179
180 ret |= usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, 0x01)); 180 ret |= usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, 0x01));
181 181
182 ret |= lme2510_bulk_write(d->udev, buff, wlen , 0x01); 182 ret |= lme2510_bulk_write(d->udev, buff, wlen , 0x01);
@@ -1247,7 +1247,7 @@ static struct dvb_usb_device_properties lme2510c_properties = {
1247 } 1247 }
1248}; 1248};
1249 1249
1250void *lme2510_exit_int(struct dvb_usb_device *d) 1250static void *lme2510_exit_int(struct dvb_usb_device *d)
1251{ 1251{
1252 struct lme2510_state *st = d->priv; 1252 struct lme2510_state *st = d->priv;
1253 struct dvb_usb_adapter *adap = &d->adapter[0]; 1253 struct dvb_usb_adapter *adap = &d->adapter[0];
@@ -1274,7 +1274,7 @@ void *lme2510_exit_int(struct dvb_usb_device *d)
1274 return buffer; 1274 return buffer;
1275} 1275}
1276 1276
1277void lme2510_exit(struct usb_interface *intf) 1277static void lme2510_exit(struct usb_interface *intf)
1278{ 1278{
1279 struct dvb_usb_device *d = usb_get_intfdata(intf); 1279 struct dvb_usb_device *d = usb_get_intfdata(intf);
1280 void *usb_buffer; 1280 void *usb_buffer;
@@ -1316,5 +1316,5 @@ module_exit(lme2510_module_exit);
1316 1316
1317MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); 1317MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
1318MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); 1318MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0");
1319MODULE_VERSION("1.84"); 1319MODULE_VERSION("1.85");
1320MODULE_LICENSE("GPL"); 1320MODULE_LICENSE("GPL");