Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f094e4f358c2f9f0a46dc777f64ed7794f73d283
Commit:     f094e4f358c2f9f0a46dc777f64ed7794f73d283
Parent:     931384fb0ec99a7459b3052f5d4db15bcb5037ea
Author:     Greg Kroah-Hartman <[EMAIL PROTECTED]>
AuthorDate: Thu Apr 26 00:12:01 2007 -0700
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Fri Apr 27 13:28:40 2007 -0700

    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 <[EMAIL PROTECTED]>
---
 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 4865aff..644607d 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));
        }
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to