Skip to content

Commit fe6bb59

Browse files
author
Al Viro
committed
usb: get rid of pointless access_ok() calls
in all affected cases addresses are passed only to copy_from()_user or copy_to_user(). Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent e6c0433 commit fe6bb59

File tree

3 files changed

+0
-17
lines changed

3 files changed

+0
-17
lines changed

drivers/usb/core/devices.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,6 @@ static ssize_t usb_device_read(struct file *file, char __user *buf,
598598
return -EINVAL;
599599
if (nbytes <= 0)
600600
return 0;
601-
if (!access_ok(buf, nbytes))
602-
return -EFAULT;
603601

604602
mutex_lock(&usb_bus_idr_lock);
605603
/* print devices for all busses */

drivers/usb/core/devio.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,11 +1127,6 @@ static int proc_control(struct usb_dev_state *ps, void __user *arg)
11271127
ctrl.bRequestType, ctrl.bRequest, ctrl.wValue,
11281128
ctrl.wIndex, ctrl.wLength);
11291129
if (ctrl.bRequestType & 0x80) {
1130-
if (ctrl.wLength && !access_ok(ctrl.data,
1131-
ctrl.wLength)) {
1132-
ret = -EINVAL;
1133-
goto done;
1134-
}
11351130
pipe = usb_rcvctrlpipe(dev, 0);
11361131
snoop_urb(dev, NULL, pipe, ctrl.wLength, tmo, SUBMIT, NULL, 0);
11371132

@@ -1216,10 +1211,6 @@ static int proc_bulk(struct usb_dev_state *ps, void __user *arg)
12161211
}
12171212
tmo = bulk.timeout;
12181213
if (bulk.ep & 0x80) {
1219-
if (len1 && !access_ok(bulk.data, len1)) {
1220-
ret = -EINVAL;
1221-
goto done;
1222-
}
12231214
snoop_urb(dev, NULL, pipe, len1, tmo, SUBMIT, NULL, 0);
12241215

12251216
usb_unlock_device(dev);

drivers/usb/gadget/function/f_hid.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,6 @@ static ssize_t f_hidg_read(struct file *file, char __user *buffer,
252252
if (!count)
253253
return 0;
254254

255-
if (!access_ok(buffer, count))
256-
return -EFAULT;
257-
258255
spin_lock_irqsave(&hidg->read_spinlock, flags);
259256

260257
#define READ_COND (!list_empty(&hidg->completed_out_req))
@@ -339,9 +336,6 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer,
339336
unsigned long flags;
340337
ssize_t status = -ENOMEM;
341338

342-
if (!access_ok(buffer, count))
343-
return -EFAULT;
344-
345339
spin_lock_irqsave(&hidg->write_spinlock, flags);
346340

347341
#define WRITE_COND (!hidg->write_pending)

0 commit comments

Comments
 (0)