Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: serial: fix invalid user-pointer checks

Drop invalid user-pointer checks from ioctl handlers.

A NULL-pointer can be valid in user space and copy_to_user() takes care
of sanity checking.

Signed-off-by: Johan Hovold <johan@kernel.org>

-32
-5
drivers/usb/serial/ftdi_sio.c
··· 1452 1452 struct ftdi_private *priv = usb_get_serial_port_data(port); 1453 1453 struct serial_struct tmp; 1454 1454 1455 - if (!retinfo) 1456 - return -EFAULT; 1457 1455 memset(&tmp, 0, sizeof(tmp)); 1458 1456 tmp.flags = priv->flags; 1459 1457 tmp.baud_base = priv->baud_base; ··· 1532 1534 { 1533 1535 struct ftdi_private *priv = usb_get_serial_port_data(port); 1534 1536 unsigned int result = 0; 1535 - 1536 - if (!retinfo) 1537 - return -EFAULT; 1538 1537 1539 1538 if (priv->transmit_empty) 1540 1539 result = TIOCSER_TEMT;
-3
drivers/usb/serial/io_edgeport.c
··· 1554 1554 { 1555 1555 struct serial_struct tmp; 1556 1556 1557 - if (!retinfo) 1558 - return -EFAULT; 1559 - 1560 1557 memset(&tmp, 0, sizeof(tmp)); 1561 1558 1562 1559 tmp.type = PORT_16550A;
-3
drivers/usb/serial/io_ti.c
··· 2459 2459 struct serial_struct tmp; 2460 2460 unsigned cwait; 2461 2461 2462 - if (!retinfo) 2463 - return -EFAULT; 2464 - 2465 2462 cwait = edge_port->port->port.closing_wait; 2466 2463 if (cwait != ASYNC_CLOSING_WAIT_NONE) 2467 2464 cwait = jiffies_to_msecs(cwait) / 10;
-3
drivers/usb/serial/mos7720.c
··· 1861 1861 { 1862 1862 struct serial_struct tmp; 1863 1863 1864 - if (!retinfo) 1865 - return -EFAULT; 1866 - 1867 1864 memset(&tmp, 0, sizeof(tmp)); 1868 1865 1869 1866 tmp.type = PORT_16550A;
-3
drivers/usb/serial/mos7840.c
··· 1956 1956 if (mos7840_port == NULL) 1957 1957 return -1; 1958 1958 1959 - if (!retinfo) 1960 - return -EFAULT; 1961 - 1962 1959 memset(&tmp, 0, sizeof(tmp)); 1963 1960 1964 1961 tmp.type = PORT_16550A;
-3
drivers/usb/serial/opticon.c
··· 336 336 { 337 337 struct serial_struct tmp; 338 338 339 - if (!serial) 340 - return -EFAULT; 341 - 342 339 memset(&tmp, 0x00, sizeof(tmp)); 343 340 344 341 /* fake emulate a 16550 uart to make userspace code happy */
-3
drivers/usb/serial/quatech2.c
··· 463 463 { 464 464 struct serial_struct tmp; 465 465 466 - if (!retinfo) 467 - return -EFAULT; 468 - 469 466 memset(&tmp, 0, sizeof(tmp)); 470 467 tmp.line = port->minor; 471 468 tmp.port = 0;
-3
drivers/usb/serial/ssu100.c
··· 318 318 { 319 319 struct serial_struct tmp; 320 320 321 - if (!retinfo) 322 - return -EFAULT; 323 - 324 321 memset(&tmp, 0, sizeof(tmp)); 325 322 tmp.line = port->minor; 326 323 tmp.port = 0;
-3
drivers/usb/serial/ti_usb_3410_5052.c
··· 1426 1426 struct serial_struct ret_serial; 1427 1427 unsigned cwait; 1428 1428 1429 - if (!ret_arg) 1430 - return -EFAULT; 1431 - 1432 1429 cwait = port->port.closing_wait; 1433 1430 if (cwait != ASYNC_CLOSING_WAIT_NONE) 1434 1431 cwait = jiffies_to_msecs(cwait) / 10;
-3
drivers/usb/serial/usb_wwan.c
··· 140 140 { 141 141 struct serial_struct tmp; 142 142 143 - if (!retinfo) 144 - return -EFAULT; 145 - 146 143 memset(&tmp, 0, sizeof(tmp)); 147 144 tmp.line = port->minor; 148 145 tmp.port = port->port_number;