[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <63953090.3ef41.18793a73009.Coremail.u202112136@hust.edu.cn>
Date: Tue, 18 Apr 2023 17:17:00 +0800 (GMT+08:00)
From: 李阳 <u202112136@...t.edu.cn>
To: "greg kroah-hartman" <gregkh@...uxfoundation.org>,
"felipe balbi" <balbi@...nel.org>,
"sergey shtylyov" <s.shtylyov@....ru>
Cc: "dongliang mu" <dzm91@...t.edu.cn>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org,
hust-os-kernel-patches@...glegroups.com
Subject: Re: [PATCH] usb: phy: phy-tahvo: fix memory leak in
tahvo_usb_probe()
> -----Original Messages-----
> From: "Li Yang" <lidaxian@...t.edu.cn>
> Sent Time: 2023-04-18 17:07:57 (Tuesday)
> To: "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>, "Felipe Balbi" <balbi@...nel.org>, "Sergey Shtylyov" <s.shtylyov@....ru>
> Cc: "Li Yang" <lidaxian@...t.edu.cn>, "Dongliang Mu" <dzm91@...t.edu.cn>, linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
> Subject: [PATCH] usb: phy: phy-tahvo: fix memory leak in tahvo_usb_probe()
>
> Smatch reports:
> drivers/usb/phy/phy-tahvo.c: tahvo_usb_probe()
> warn: missing unwind goto?
>
> After geting irq, if ret < 0, it will return without error handling to
> free memory.
> Just add error handling to fix this problem.
>
> Fixes: 0d45a1373e66 ("usb: phy: tahvo: add IRQ check")
> Signed-off-by: Li Yang <lidaxian@...t.edu.cn>
> Reviewed-by: Dongliang Mu <dzm91@...t.edu.cn>
> ---
> The issue is found by static analysis, and the patch remains untest.
> ---
> drivers/usb/phy/phy-tahvo.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
> index f2d2cc586c5b..184a5f3d7473 100644
> --- a/drivers/usb/phy/phy-tahvo.c
> +++ b/drivers/usb/phy/phy-tahvo.c
> @@ -390,8 +390,11 @@ static int tahvo_usb_probe(struct platform_device *pdev)
> dev_set_drvdata(&pdev->dev, tu);
>
> tu->irq = ret = platform_get_irq(pdev, 0);
> - if (ret < 0)
> - return ret;
> + if (ret < 0) {
> + dev_err(&pdev->dev, "could not get irq: %d\n",
> + ret);
> + goto err_remove_phy;
> + }
> ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt,
> IRQF_ONESHOT,
> "tahvo-vbus", tu);
> --
> 2.34.1
cc hust-os-kernel-patches@...glegroups.com
Powered by blists - more mailing lists