diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-04-26 09:12:01 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-04-27 22:28:40 +0200 |
commit | f094e4f358c2f9f0a46dc777f64ed7794f73d283 (patch) | |
tree | 6e811c05b224227a04a91558f923d7348ada219d /drivers/usb/serial/sierra.c | |
parent | USB: add an ohci board-specific quirk (diff) | |
download | linux-f094e4f358c2f9f0a46dc777f64ed7794f73d283.tar.xz linux-f094e4f358c2f9f0a46dc777f64ed7794f73d283.zip |
USB: sierra: add more checks on shutdown
This should help with any potential NULL pointer usages as reported by a
few users.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/sierra.c')
-rw-r--r-- | drivers/usb/serial/sierra.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 4865aff892e8..644607de4c11 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -577,7 +577,12 @@ static void sierra_shutdown(struct usb_serial *serial) /* Stop reading/writing urbs */ for (i = 0; i < serial->num_ports; ++i) { port = serial->port[i]; + if (!port) + continue; portdata = usb_get_serial_port_data(port); + if (!portdata) + continue; + for (j = 0; j < N_IN_URB; j++) usb_unlink_urb(portdata->in_urbs[j]); for (j = 0; j < N_OUT_URB; j++) @@ -587,7 +592,11 @@ static void sierra_shutdown(struct usb_serial *serial) /* Now free them */ for (i = 0; i < serial->num_ports; ++i) { port = serial->port[i]; + if (!port) + continue; portdata = usb_get_serial_port_data(port); + if (!portdata) + continue; for (j = 0; j < N_IN_URB; j++) { if (portdata->in_urbs[j]) { @@ -606,6 +615,8 @@ static void sierra_shutdown(struct usb_serial *serial) /* Now free per port private data */ for (i = 0; i < serial->num_ports; i++) { port = serial->port[i]; + if (!port) + continue; kfree(usb_get_serial_port_data(port)); } } |