From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 508E21863 for ; Wed, 28 Dec 2022 15:30:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9825C433D2; Wed, 28 Dec 2022 15:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1672241448; bh=Lo+z/ksi6TJW+4fOI3/ioxvulWTy79WUrGww0ha3Hlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OPU1Fi+/64UQJzxKOK9FMnqO+6cnJePVA5r/oJiYL0WcLsP6ImJl3xw73AdiHsvgt 3IhbaNOIocjYLUsdpZ5BlSl/dew6Im5WFmriwBhSImkkHqtoC0kYq1i2sZSxzb1pVQ OMhvvgkCyzu91pc4eyN66Aa6x0ToZtt2QJWal8UE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhengchao Shao , Johannes Thumshirn , Sasha Levin Subject: [PATCH 5.15 483/731] drivers: mcb: fix resource leak in mcb_probe() Date: Wed, 28 Dec 2022 15:39:50 +0100 Message-Id: <20221228144310.551485686@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221228144256.536395940@linuxfoundation.org> References: <20221228144256.536395940@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Zhengchao Shao [ Upstream commit d7237462561fcd224fa687c56ccb68629f50fc0d ] When probe hook function failed in mcb_probe(), it doesn't put the device. Compiled test only. Fixes: 7bc364097a89 ("mcb: Acquire reference to device in probe") Signed-off-by: Zhengchao Shao Signed-off-by: Johannes Thumshirn Link: https://lore.kernel.org/r/9f87de36bfb85158b506cb78c6fc9db3f6a3bad1.1669624063.git.johannes.thumshirn@wdc.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/mcb/mcb-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c index cf128b3471d7..0530db548231 100644 --- a/drivers/mcb/mcb-core.c +++ b/drivers/mcb/mcb-core.c @@ -71,8 +71,10 @@ static int mcb_probe(struct device *dev) get_device(dev); ret = mdrv->probe(mdev, found_id); - if (ret) + if (ret) { module_put(carrier_mod); + put_device(dev); + } return ret; } -- 2.35.1