aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2015-02-17 22:34:50 -0500
committerJohan Hovold <johan@kernel.org>2015-02-26 11:08:36 -0500
commit07fdfc5e9f1c966be8722e8fa927e5ea140df5ce (patch)
tree4728261d05363f71ff04ce4defe2f5a37cb0fa67 /drivers/usb/serial
parent5ee0089b1f7057d8f783db37b2a8116cd114f6e5 (diff)
USB: serial: fix potential use-after-free after failed probe
Fix return value in probe error path, which could end up returning success (0) on errors. This could in turn lead to use-after-free or double free (e.g. in port_remove) when the port device is removed. Fixes: c706ebdfc895 ("USB: usb-serial: call port_probe and port_remove at the right times") Cc: stable <stable@vger.kernel.org> # v2.6.31 Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/bus.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index 9374bd2aba20..5d8d86666b90 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -75,7 +75,7 @@ static int usb_serial_device_probe(struct device *dev)
75 retval = device_create_file(dev, &dev_attr_port_number); 75 retval = device_create_file(dev, &dev_attr_port_number);
76 if (retval) { 76 if (retval) {
77 if (driver->port_remove) 77 if (driver->port_remove)
78 retval = driver->port_remove(port); 78 driver->port_remove(port);
79 goto exit_with_autopm; 79 goto exit_with_autopm;
80 } 80 }
81 81