public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Qiang Ning <qning0106@126.com>, Lee Jones <lee@kernel.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 6.1 6/8] mfd: dln2: Fix memory leak in dln2_probe()
Date: Wed, 10 May 2023 16:49:47 -0400	[thread overview]
Message-ID: <20230510204950.104873-6-sashal@kernel.org> (raw)
In-Reply-To: <20230510204950.104873-1-sashal@kernel.org>

From: Qiang Ning <qning0106@126.com>

[ Upstream commit 96da8f148396329ba769246cb8ceaa35f1ddfc48 ]

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>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230330024353.4503-1-qning0106@126.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mfd/dln2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
index 6cd0b0c752d6e..c3149729cec2e 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.39.2


  parent reply	other threads:[~2023-05-10 20:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-10 20:49 [PATCH AUTOSEL 6.1 1/8] soundwire: dmi-quirks: add remapping for Intel 'Rooks County' NUC M15 Sasha Levin
2023-05-10 20:49 ` [PATCH AUTOSEL 6.1 2/8] phy: st: miphy28lp: use _poll_timeout functions for waits Sasha Levin
2023-05-10 20:49 ` [PATCH AUTOSEL 6.1 3/8] soundwire: qcom: gracefully handle too many ports in DT Sasha Levin
2023-05-10 20:49 ` [PATCH AUTOSEL 6.1 4/8] soundwire: bus: Fix unbalanced pm_runtime_put() causing usage count underflow Sasha Levin
2023-05-10 20:49 ` [PATCH AUTOSEL 6.1 5/8] mfd: intel_soc_pmic_chtwc: Add Lenovo Yoga Book X90F to intel_cht_wc_models Sasha Levin
2023-05-10 20:49 ` Sasha Levin [this message]
2023-05-10 20:49 ` [PATCH AUTOSEL 6.1 7/8] mfd: intel-lpss: Add Intel Meteor Lake PCH-S LPSS PCI IDs Sasha Levin
2023-05-10 20:49 ` [PATCH AUTOSEL 6.1 8/8] parisc: Replace regular spinlock with spin_trylock on panic path Sasha Levin

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