Commit 59a9543f authored by Johan Hovold's avatar Johan Hovold Committed by Jiri Slaby

USB: keyspan: fix null-deref at probe

commit b5122236 upstream.

Fix null-pointer dereference during probe if the interface-status
completion handler is called before the individual ports have been set
up.

Fixes: f79b2d0f ("USB: keyspan: fix NULL-pointer dereferences and
memory leaks")
Reported-by: default avatarRichard <richjunk@pacbell.net>
Tested-by: default avatarRichard <richjunk@pacbell.net>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 689b7699
......@@ -422,6 +422,8 @@ static void usa26_instat_callback(struct urb *urb)
}
port = serial->port[msg->port];
p_priv = usb_get_serial_port_data(port);
if (!p_priv)
goto resubmit;
/* Update handshaking pin state information */
old_dcd_state = p_priv->dcd_state;
......@@ -432,7 +434,7 @@ static void usa26_instat_callback(struct urb *urb)
if (old_dcd_state != p_priv->dcd_state)
tty_port_tty_hangup(&port->port, true);
resubmit:
/* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0)
......@@ -542,6 +544,8 @@ static void usa28_instat_callback(struct urb *urb)
}
port = serial->port[msg->port];
p_priv = usb_get_serial_port_data(port);
if (!p_priv)
goto resubmit;
/* Update handshaking pin state information */
old_dcd_state = p_priv->dcd_state;
......@@ -552,7 +556,7 @@ static void usa28_instat_callback(struct urb *urb)
if (old_dcd_state != p_priv->dcd_state && old_dcd_state)
tty_port_tty_hangup(&port->port, true);
resubmit:
/* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0)
......@@ -625,6 +629,8 @@ static void usa49_instat_callback(struct urb *urb)
}
port = serial->port[msg->portNumber];
p_priv = usb_get_serial_port_data(port);
if (!p_priv)
goto resubmit;
/* Update handshaking pin state information */
old_dcd_state = p_priv->dcd_state;
......@@ -635,7 +641,7 @@ static void usa49_instat_callback(struct urb *urb)
if (old_dcd_state != p_priv->dcd_state && old_dcd_state)
tty_port_tty_hangup(&port->port, true);
resubmit:
/* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0)
......@@ -873,6 +879,8 @@ static void usa90_instat_callback(struct urb *urb)
port = serial->port[0];
p_priv = usb_get_serial_port_data(port);
if (!p_priv)
goto resubmit;
/* Update handshaking pin state information */
old_dcd_state = p_priv->dcd_state;
......@@ -883,7 +891,7 @@ static void usa90_instat_callback(struct urb *urb)
if (old_dcd_state != p_priv->dcd_state && old_dcd_state)
tty_port_tty_hangup(&port->port, true);
resubmit:
/* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0)
......@@ -944,6 +952,8 @@ static void usa67_instat_callback(struct urb *urb)
port = serial->port[msg->port];
p_priv = usb_get_serial_port_data(port);
if (!p_priv)
goto resubmit;
/* Update handshaking pin state information */
old_dcd_state = p_priv->dcd_state;
......@@ -952,7 +962,7 @@ static void usa67_instat_callback(struct urb *urb)
if (old_dcd_state != p_priv->dcd_state && old_dcd_state)
tty_port_tty_hangup(&port->port, true);
resubmit:
/* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0)
......
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