Re: [PATCH v2 0/3] pinctrl: fix possible memory leak when pinctrl_enable() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 6, 2024 at 4:39 AM Yang Yingliang <yangyingliang@xxxxxxxxxx> wrote:

> In devm_pinctrl_register(), if pinctrl_enable() fails in pinctrl_register(),
> the "pctldev" has not been added to dev resources, so devm_pinctrl_dev_release()
> can not be called, it leads memory leak.
>
> And some driver calls pinctrl_register_and_init() which is not devm_ managed,
> it also leads memory leak if pinctrl_enable() fails.
>
> To fix this, introduce pinctrl_uninit_controller(), call it in the error path to
> free memory and replace pinctrl_register_and_init with devm_pinctrl_register_and_init.
>
> v1 -> v2:
>   Check pinctrl_enable() return value in pcs_probe() in patch #2

Patches applied as nonurgent fixes.

Thanks Yang!

Yours,
Linus Walleij





[Index of Archives]     [Linux SPI]     [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]

  Powered by Linux