Re: [PATCH 06/31] serial: qcom_geni_serial: fix potential mem leak in qcom_geni_serial_probe()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [PATCH 06/31] serial: qcom_geni_serial: fix potential mem leak in qcom_geni_serial_probe()
- From: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
- Date: Mon, 4 Jan 2021 12:32:36 +0530
- Cc: myungjoo.ham@xxxxxxxxxxx, kyungmin.park@xxxxxxxxxxx, cw00.choi@xxxxxxxxxxx, krzk@xxxxxxxxxx, shawnguo@xxxxxxxxxx, s.hauer@xxxxxxxxxxxxxx, kernel@xxxxxxxxxxxxxx, festevam@xxxxxxxxx, linux-imx@xxxxxxx, digetx@xxxxxxxxx, thierry.reding@xxxxxxxxx, jonathanh@xxxxxxxxxx, yuq825@xxxxxxxxx, airlied@xxxxxxxx, daniel@xxxxxxxx, robdclark@xxxxxxxxx, sean@xxxxxxxxxx, robh@xxxxxxxxxx, tomeu.vizoso@xxxxxxxxxxxxx, steven.price@xxxxxxx, alyssa.rosenzweig@xxxxxxxxxxxxx, stanimir.varbanov@xxxxxxxxxx, agross@xxxxxxxxxx, bjorn.andersson@xxxxxxxxxx, mchehab@xxxxxxxxxx, lukasz.luba@xxxxxxx, adrian.hunter@xxxxxxxxx, ulf.hansson@xxxxxxxxxx, vireshk@xxxxxxxxxx, nm@xxxxxx, sboyd@xxxxxxxxxx, broonie@xxxxxxxxxx, gregkh@xxxxxxxxxxxxxxxxxxx, jirislaby@xxxxxxxxxx, rjw@xxxxxxxxxxxxx, jcrouse@xxxxxxxxxxxxxx, hoegsberg@xxxxxxxxxx, eric@xxxxxxxxxxxxxxxxxx, tzimmermann@xxxxxxx, marijn.suijten@xxxxxxxxxxxxxx, gustavoars@xxxxxxxxxx, emil.velikov@xxxxxxxxxxxxx, jonathan@xxxxxxxx, akhilpo@xxxxxxxxxxxxxx, smasetty@xxxxxxxxxxxxxx, airlied@xxxxxxxxxx, masneyb@xxxxxxxxxxxxx, kalyan_t@xxxxxxxxxxxxxx, tanmay@xxxxxxxxxxxxxx, ddavenport@xxxxxxxxxxxx, jsanka@xxxxxxxxxxxxxx, rnayak@xxxxxxxxxxxxxx, tongtiangen@xxxxxxxxxx, miaoqinglang@xxxxxxxxxx, khsieh@xxxxxxxxxxxxxx, abhinavk@xxxxxxxxxxxxxx, chandanu@xxxxxxxxxxxxxx, groeck@xxxxxxxxxxxx, varar@xxxxxxxxxxxxxx, mka@xxxxxxxxxxxx, harigovi@xxxxxxxxxxxxxx, rikard.falkeborn@xxxxxxxxx, natechancellor@xxxxxxxxx, georgi.djakov@xxxxxxxxxx, akashast@xxxxxxxxxxxxxx, parashar@xxxxxxxxxxxxxx, dianders@xxxxxxxxxxxx, linux-pm@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-tegra@xxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx, lima@xxxxxxxxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx, freedreno@xxxxxxxxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx, linux-mmc@xxxxxxxxxxxxxxx, linux-spi@xxxxxxxxxxxxxxx, linux-serial@xxxxxxxxxxxxxxx
- In-reply-to: <20210101165507.19486-7-tiny.windzz@gmail.com>
- References: <20210101165507.19486-1-tiny.windzz@gmail.com> <20210101165507.19486-7-tiny.windzz@gmail.com>
- User-agent: NeoMutt/20180716-391-311a52
On 01-01-21, 16:54, Yangtao Li wrote:
> We should use dev_pm_opp_put_clkname() to free opp table each time
> dev_pm_opp_of_add_table() got error.
>
> Signed-off-by: Yangtao Li <tiny.windzz@xxxxxxxxx>
> ---
> drivers/tty/serial/qcom_geni_serial.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 291649f02821..5aada7ebae35 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -1438,9 +1438,12 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
> return PTR_ERR(port->se.opp_table);
> /* OPP table is optional */
> ret = dev_pm_opp_of_add_table(&pdev->dev);
> - if (ret && ret != -ENODEV) {
> - dev_err(&pdev->dev, "invalid OPP table in device tree\n");
> - goto put_clkname;
> + if (ret) {
> + dev_pm_opp_put_clkname(port->se.opp_table);
> + if (ret != -ENODEV) {
> + dev_err(&pdev->dev, "invalid OPP table in device tree\n");
> + return ret;
> + }
> }
>
> port->private_data.drv = drv;
> @@ -1482,7 +1485,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
> return 0;
> err:
> dev_pm_opp_of_remove_table(&pdev->dev);
> -put_clkname:
> dev_pm_opp_put_clkname(port->se.opp_table);
> return ret;
> }
Since put_clkname is always done in remove(), I don't think there is
any memleak here. Over that with your patch we will do put_clkname
twice now, once in probe and once in remove. And that is a bug AFAICT.
--
viresh
[Index of Archives]
[Linux Kernel]
[Linux ARM (vger)]
[Linux ARM MSM]
[Linux Omap]
[Linux Arm]
[Linux Tegra]
[Fedora ARM]
[Linux for Samsung SOC]
[eCos]
[Linux Fastboot]
[Gcc Help]
[Git]
[DCCP]
[IETF Announce]
[Security]
[Linux MIPS]
[Yosemite Campsites]
|