diff mbox series

[1/7] USB: cdc-acm: fix double free on probe failure

Message ID 20210318155202.22230-2-johan@kernel.org
State Superseded
Headers show
Series USB: cdc-acm: probe fixes | expand

Commit Message

Johan Hovold March 18, 2021, 3:51 p.m. UTC
If tty-device registration fails the driver copy of any Country
Selection functional descriptor would end up being freed twice; first
explicitly in the error path and then again in the tty-port destructor.

Drop the first erroneous free that was left when fixing a tty-port
resource leak.

Fixes: cae2bc768d17 ("usb: cdc-acm: Decrement tty port's refcount if probe() fail")
Cc: stable@vger.kernel.org      # 4.19
Cc: Jaejoong Kim <climbbb.kim@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/class/cdc-acm.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Oliver Neukum March 22, 2021, 9:38 a.m. UTC | #1
Am Donnerstag, den 18.03.2021, 16:51 +0100 schrieb Johan Hovold:
> If tty-device registration fails the driver copy of any Country

> Selection functional descriptor would end up being freed twice; first

> explicitly in the error path and then again in the tty-port destructor.

> 

> Drop the first erroneous free that was left when fixing a tty-port

> resource leak.

> 

> Fixes: cae2bc768d17 ("usb: cdc-acm: Decrement tty port's refcount if probe() fail")

> Cc: stable@vger.kernel.org      # 4.19

> Cc: Jaejoong Kim <climbbb.kim@gmail.com>

> Signed-off-by: Johan Hovold <johan@kernel.org>

Acked-by: Oliver Neukum <oneukum@suse.com>
diff mbox series

Patch

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 39ddb5585ded..d75a78ad464d 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1508,7 +1508,6 @@  static int acm_probe(struct usb_interface *intf,
 				&dev_attr_wCountryCodes);
 		device_remove_file(&acm->control->dev,
 				&dev_attr_iCountryCodeRelDate);
-		kfree(acm->country_codes);
 	}
 	device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities);
 alloc_fail5: