diff options
author | Johan Hovold <johan@kernel.org> | 2015-02-18 10:34:50 +0700 |
---|---|---|
committer | Zefan Li <lizefan@huawei.com> | 2015-06-19 11:40:19 +0800 |
commit | 97d0aa6b49d5c27495061a7a10c5f743f5c5209e (patch) | |
tree | 340c63ef1af137bbb92f313017366092e5873083 /drivers/usb | |
parent | a10ca36cd94e92f3fc6e5702f5d5e09d94a6e073 (diff) |
USB: serial: fix potential use-after-free after failed probe
commit 07fdfc5e9f1c966be8722e8fa927e5ea140df5ce upstream.
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")
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <greg@kroah.com>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/bus.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index ed8adb052ca7..1b596656da14 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c @@ -71,7 +71,7 @@ static int usb_serial_device_probe(struct device *dev) retval = device_create_file(dev, &dev_attr_port_number); if (retval) { if (driver->port_remove) - retval = driver->port_remove(port); + driver->port_remove(port); goto exit; } |