Commit a3895794 authored by Johan Hovold's avatar Johan Hovold Committed by Khalid Elmously

USB: serial: keyspan: handle unbound ports

BugLink: https://bugs.launchpad.net/bugs/1860681

[ Upstream commit 3018dd3f ]

Check for NULL port data in the control URB completion handlers to avoid
dereferencing a NULL pointer in the unlikely case where a port device
isn't bound to a driver (e.g. after an allocation failure on port
probe()).

Fixes: 0ca1268e ("USB Serial Keyspan: add support for USA-49WG & USA-28XG")
Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent e0746615
...@@ -565,6 +565,8 @@ static void usa49_glocont_callback(struct urb *urb) ...@@ -565,6 +565,8 @@ static void usa49_glocont_callback(struct urb *urb)
for (i = 0; i < serial->num_ports; ++i) { for (i = 0; i < serial->num_ports; ++i) {
port = serial->port[i]; port = serial->port[i];
p_priv = usb_get_serial_port_data(port); p_priv = usb_get_serial_port_data(port);
if (!p_priv)
continue;
if (p_priv->resend_cont) { if (p_priv->resend_cont) {
dev_dbg(&port->dev, "%s - sending setup\n", __func__); dev_dbg(&port->dev, "%s - sending setup\n", __func__);
...@@ -962,6 +964,8 @@ static void usa67_glocont_callback(struct urb *urb) ...@@ -962,6 +964,8 @@ static void usa67_glocont_callback(struct urb *urb)
for (i = 0; i < serial->num_ports; ++i) { for (i = 0; i < serial->num_ports; ++i) {
port = serial->port[i]; port = serial->port[i];
p_priv = usb_get_serial_port_data(port); p_priv = usb_get_serial_port_data(port);
if (!p_priv)
continue;
if (p_priv->resend_cont) { if (p_priv->resend_cont) {
dev_dbg(&port->dev, "%s - sending setup\n", __func__); dev_dbg(&port->dev, "%s - sending setup\n", __func__);
......
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