mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 15:10:38 +00:00
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>
This commit is contained in:
parent
a98b69002a
commit
2fbd69c4e3
@ -1452,8 +1452,6 @@ static int get_serial_info(struct usb_serial_port *port,
|
|||||||
struct ftdi_private *priv = usb_get_serial_port_data(port);
|
struct ftdi_private *priv = usb_get_serial_port_data(port);
|
||||||
struct serial_struct tmp;
|
struct serial_struct tmp;
|
||||||
|
|
||||||
if (!retinfo)
|
|
||||||
return -EFAULT;
|
|
||||||
memset(&tmp, 0, sizeof(tmp));
|
memset(&tmp, 0, sizeof(tmp));
|
||||||
tmp.flags = priv->flags;
|
tmp.flags = priv->flags;
|
||||||
tmp.baud_base = priv->baud_base;
|
tmp.baud_base = priv->baud_base;
|
||||||
@ -1535,9 +1533,6 @@ static int get_lsr_info(struct usb_serial_port *port,
|
|||||||
struct ftdi_private *priv = usb_get_serial_port_data(port);
|
struct ftdi_private *priv = usb_get_serial_port_data(port);
|
||||||
unsigned int result = 0;
|
unsigned int result = 0;
|
||||||
|
|
||||||
if (!retinfo)
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
if (priv->transmit_empty)
|
if (priv->transmit_empty)
|
||||||
result = TIOCSER_TEMT;
|
result = TIOCSER_TEMT;
|
||||||
|
|
||||||
|
@ -1554,9 +1554,6 @@ static int get_serial_info(struct edgeport_port *edge_port,
|
|||||||
{
|
{
|
||||||
struct serial_struct tmp;
|
struct serial_struct tmp;
|
||||||
|
|
||||||
if (!retinfo)
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
memset(&tmp, 0, sizeof(tmp));
|
memset(&tmp, 0, sizeof(tmp));
|
||||||
|
|
||||||
tmp.type = PORT_16550A;
|
tmp.type = PORT_16550A;
|
||||||
|
@ -2459,9 +2459,6 @@ static int get_serial_info(struct edgeport_port *edge_port,
|
|||||||
struct serial_struct tmp;
|
struct serial_struct tmp;
|
||||||
unsigned cwait;
|
unsigned cwait;
|
||||||
|
|
||||||
if (!retinfo)
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
cwait = edge_port->port->port.closing_wait;
|
cwait = edge_port->port->port.closing_wait;
|
||||||
if (cwait != ASYNC_CLOSING_WAIT_NONE)
|
if (cwait != ASYNC_CLOSING_WAIT_NONE)
|
||||||
cwait = jiffies_to_msecs(cwait) / 10;
|
cwait = jiffies_to_msecs(cwait) / 10;
|
||||||
|
@ -1861,9 +1861,6 @@ static int get_serial_info(struct moschip_port *mos7720_port,
|
|||||||
{
|
{
|
||||||
struct serial_struct tmp;
|
struct serial_struct tmp;
|
||||||
|
|
||||||
if (!retinfo)
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
memset(&tmp, 0, sizeof(tmp));
|
memset(&tmp, 0, sizeof(tmp));
|
||||||
|
|
||||||
tmp.type = PORT_16550A;
|
tmp.type = PORT_16550A;
|
||||||
|
@ -1956,9 +1956,6 @@ static int mos7840_get_serial_info(struct moschip_port *mos7840_port,
|
|||||||
if (mos7840_port == NULL)
|
if (mos7840_port == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!retinfo)
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
memset(&tmp, 0, sizeof(tmp));
|
memset(&tmp, 0, sizeof(tmp));
|
||||||
|
|
||||||
tmp.type = PORT_16550A;
|
tmp.type = PORT_16550A;
|
||||||
|
@ -336,9 +336,6 @@ static int get_serial_info(struct usb_serial_port *port,
|
|||||||
{
|
{
|
||||||
struct serial_struct tmp;
|
struct serial_struct tmp;
|
||||||
|
|
||||||
if (!serial)
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
memset(&tmp, 0x00, sizeof(tmp));
|
memset(&tmp, 0x00, sizeof(tmp));
|
||||||
|
|
||||||
/* fake emulate a 16550 uart to make userspace code happy */
|
/* fake emulate a 16550 uart to make userspace code happy */
|
||||||
|
@ -463,9 +463,6 @@ static int get_serial_info(struct usb_serial_port *port,
|
|||||||
{
|
{
|
||||||
struct serial_struct tmp;
|
struct serial_struct tmp;
|
||||||
|
|
||||||
if (!retinfo)
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
memset(&tmp, 0, sizeof(tmp));
|
memset(&tmp, 0, sizeof(tmp));
|
||||||
tmp.line = port->minor;
|
tmp.line = port->minor;
|
||||||
tmp.port = 0;
|
tmp.port = 0;
|
||||||
|
@ -318,9 +318,6 @@ static int get_serial_info(struct usb_serial_port *port,
|
|||||||
{
|
{
|
||||||
struct serial_struct tmp;
|
struct serial_struct tmp;
|
||||||
|
|
||||||
if (!retinfo)
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
memset(&tmp, 0, sizeof(tmp));
|
memset(&tmp, 0, sizeof(tmp));
|
||||||
tmp.line = port->minor;
|
tmp.line = port->minor;
|
||||||
tmp.port = 0;
|
tmp.port = 0;
|
||||||
|
@ -1426,9 +1426,6 @@ static int ti_get_serial_info(struct ti_port *tport,
|
|||||||
struct serial_struct ret_serial;
|
struct serial_struct ret_serial;
|
||||||
unsigned cwait;
|
unsigned cwait;
|
||||||
|
|
||||||
if (!ret_arg)
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
cwait = port->port.closing_wait;
|
cwait = port->port.closing_wait;
|
||||||
if (cwait != ASYNC_CLOSING_WAIT_NONE)
|
if (cwait != ASYNC_CLOSING_WAIT_NONE)
|
||||||
cwait = jiffies_to_msecs(cwait) / 10;
|
cwait = jiffies_to_msecs(cwait) / 10;
|
||||||
|
@ -140,9 +140,6 @@ static int get_serial_info(struct usb_serial_port *port,
|
|||||||
{
|
{
|
||||||
struct serial_struct tmp;
|
struct serial_struct tmp;
|
||||||
|
|
||||||
if (!retinfo)
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
memset(&tmp, 0, sizeof(tmp));
|
memset(&tmp, 0, sizeof(tmp));
|
||||||
tmp.line = port->minor;
|
tmp.line = port->minor;
|
||||||
tmp.port = port->port_number;
|
tmp.port = port->port_number;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user