diff options
author | Johan Hovold <johan@kernel.org> | 2015-02-18 10:34:50 +0700 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2015-03-12 17:31:18 +0100 |
commit | 63953db3a9758add929a797d61f76450a9117624 (patch) | |
tree | 3a2d8b7575641ecf19eb0411112b4bd0456ad365 | |
parent | 9bfa61c9a592d7d843878854a1327fd6f5432b2a (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>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-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 74fc63b2e7fc..95ee3e734209 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) 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_with_autopm; } |