All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Oliver Neukum <oneukum@suse.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Johan Hovold <johan@kernel.org>,
	stable@vger.kernel.org, Jaejoong Kim <climbbb.kim@gmail.com>
Subject: [PATCH 1/7] USB: cdc-acm: fix double free on probe failure
Date: Thu, 18 Mar 2021 16:51:56 +0100	[thread overview]
Message-ID: <20210318155202.22230-2-johan@kernel.org> (raw)
In-Reply-To: <20210318155202.22230-1-johan@kernel.org>

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(-)

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:
-- 
2.26.2


  reply	other threads:[~2021-03-18 15:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 15:51 [PATCH 0/7] USB: cdc-acm: probe fixes Johan Hovold
2021-03-18 15:51 ` Johan Hovold [this message]
2021-03-22  9:38   ` [PATCH 1/7] USB: cdc-acm: fix double free on probe failure Oliver Neukum
2021-03-18 15:51 ` [PATCH 2/7] USB: cdc-acm: fix use-after-free after " Johan Hovold
2021-03-22  9:39   ` Oliver Neukum
2021-03-18 15:51 ` [PATCH 3/7] USB: cdc-acm: drop redundant driver-data assignment Johan Hovold
2021-03-22  9:39   ` Oliver Neukum
2021-03-18 15:51 ` [PATCH 4/7] USB: cdc-acm: drop redundant driver-data reset Johan Hovold
2021-03-22  9:40   ` Oliver Neukum
2021-03-18 15:52 ` [PATCH 5/7] USB: cdc-acm: clean up probe error labels Johan Hovold
2021-03-22  9:41   ` Oliver Neukum
2021-03-18 15:52 ` [PATCH 6/7] USB: cdc-acm: use negation for NULL checks Johan Hovold
2021-03-22  9:41   ` Oliver Neukum
2021-03-18 15:52 ` [PATCH 7/7] USB: cdc-acm: always claim data interface Johan Hovold
2021-03-22 10:46   ` Oliver Neukum
2021-03-22 14:13     ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210318155202.22230-2-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=climbbb.kim@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.