lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221004091347.fotcdx75ut7zaly5@soft-dev3-1.localhost>
Date:   Tue, 4 Oct 2022 11:13:47 +0200
From:   Horatiu Vultur <horatiu.vultur@...rochip.com>
To:     Yang Yingliang <yangyingliang@...wei.com>
CC:     <linux-gpio@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linus.walleij@...aro.org>, <p.zabel@...gutronix.de>,
        <andy.shevchenko@...il.com>
Subject: Re: [PATCH -next v3] pinctrl: ocelot: add missing
 destroy_workqueue() in error path in ocelot_pinctrl_probe()

The 09/25/2022 10:12, Yang Yingliang wrote:
> 
> Using devm_add_action_or_reset() to make workqueue device-managed, so it can be
> destroy whenever the driver is unbound.

Reviewed-by: Horatiu Vultur <horatiu.vultur@...rochip.com>

> 
> Fixes: c297561bc98a ("pinctrl: ocelot: Fix interrupt controller")
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
> v3:
>   Using devm_add_action_or_reset().
> 
> v2:
>   move alloc_ordered_workqueue() after ocelot_pinctrl_register().
> ---
>  drivers/pinctrl/pinctrl-ocelot.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
> index 62ce3957abe4..266fbc957273 100644
> --- a/drivers/pinctrl/pinctrl-ocelot.c
> +++ b/drivers/pinctrl/pinctrl-ocelot.c
> @@ -2038,6 +2038,11 @@ static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev,
>         return devm_regmap_init_mmio(&pdev->dev, base, &regmap_config);
>  }
> 
> +static void ocelot_destroy_workqueue(void *data)
> +{
> +       destroy_workqueue(data);
> +}
> +
>  static int ocelot_pinctrl_probe(struct platform_device *pdev)
>  {
>         const struct ocelot_match_data *data;
> @@ -2069,6 +2074,11 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
>         if (!info->wq)
>                 return -ENOMEM;
> 
> +       ret = devm_add_action_or_reset(dev, ocelot_destroy_workqueue,
> +                                      info->wq);
> +       if (ret)
> +               return ret;
> +
>         info->pincfg_data = &data->pincfg_data;
> 
>         reset = devm_reset_control_get_optional_shared(dev, "switch");
> @@ -2110,15 +2120,6 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
>         return 0;
>  }
> 
> -static int ocelot_pinctrl_remove(struct platform_device *pdev)
> -{
> -       struct ocelot_pinctrl *info = platform_get_drvdata(pdev);
> -
> -       destroy_workqueue(info->wq);
> -
> -       return 0;
> -}
> -
>  static struct platform_driver ocelot_pinctrl_driver = {
>         .driver = {
>                 .name = "pinctrl-ocelot",
> @@ -2126,7 +2127,6 @@ static struct platform_driver ocelot_pinctrl_driver = {
>                 .suppress_bind_attrs = true,
>         },
>         .probe = ocelot_pinctrl_probe,
> -       .remove = ocelot_pinctrl_remove,
>  };
>  module_platform_driver(ocelot_pinctrl_driver);
> 
> --
> 2.25.1
> 

-- 
/Horatiu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ