mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qiang Ning <qning0106@126.com>
To: lee@kernel.org, qning0106@126.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] MFD: dln2: fix memory leak in dln2_probe
Date: Thu, 30 Mar 2023 10:43:53 +0800	[thread overview]
Message-ID: <20230330024353.4503-1-qning0106@126.com> (raw)

When dln2_setup_rx_urbs() in dln2_probe() fails, error out_free
forgets to call  usb_put_dev to decrease the refcount of
dln2->usb_dev.

Fix this by adding usb_put_dev() in the error handling code
of dln2_probe().

Signed-off-by: Qiang Ning <qning0106@126.com>
---
 drivers/mfd/dln2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
index 6cd0b0c752d6..c3149729cec2 100644
--- a/drivers/mfd/dln2.c
+++ b/drivers/mfd/dln2.c
@@ -827,6 +827,7 @@ static int dln2_probe(struct usb_interface *interface,
 	dln2_stop_rx_urbs(dln2);
 
 out_free:
+	usb_put_dev(dln2->usb_dev);
 	dln2_free(dln2);
 
 	return ret;
-- 
2.25.1


             reply	other threads:[~2023-03-30  3:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30  2:43 Qiang Ning [this message]
2023-03-30 17:07 ` Lee Jones

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=20230330024353.4503-1-qning0106@126.com \
    --to=qning0106@126.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®