[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdYqQDSpHQyTaAY4H_9jX03d6oJKOu-zDvx0iJmTE3-jiw@mail.gmail.com>
Date: Sat, 3 Dec 2022 10:41:28 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Yi Yang <yiyang13@...wei.com>
Cc: gregkh@...uxfoundation.org, andrzej.p@...labora.com,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] usb: fotg210-udc: fix potential memory leak in fotg210_udc_probe()
On Fri, Dec 2, 2022 at 2:25 AM Yi Yang <yiyang13@...wei.com> wrote:
> In fotg210_udc_probe(), if devm_clk_get() or clk_prepare_enable()
> fails, 'fotg210' will not be freed, which will lead to a memory leak.
> Fix it by moving kfree() to a proper location.
>
> In addition,we can use "return -ENOMEM" instead of "goto err"
> to simplify the code.
>
> Fixes: 718a38d092ec ("fotg210-udc: Handle PCLK")
> Signed-off-by: Yi Yang <yiyang13@...wei.com>
> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@...labora.com>
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
I have some cleanup patches switching around to devm* handling
cooking for v6.3, but let's do this for now.
Yours,
Linus Walleij
Powered by blists - more mailing lists