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]
Date:   Wed, 7 Sep 2022 21:47:54 +0200
From:   Horatiu Vultur <horatiu.vultur@...rochip.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
CC:     "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        "Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        Microchip Linux Driver Support <UNGLinuxDriver@...rochip.com>
Subject: Re: [PATCH v2] pinctrl: ocelot: Fix interrupt controller

The 09/07/2022 11:36, Andy Shevchenko wrote:
> > +        * handler.
> > +        */
> > +       if (active && !ack) {
> > +               struct ocelot_irq_work *work;
> > +
> > +               work = kmalloc(sizeof(*work), GFP_ATOMIC);
> > +               if (!work)
> > +                       return;
> > +
> > +               work->irq_desc = desc;
> > +               INIT_WORK(&work->irq_work, ocelot_irq_work);
> > +               queue_work(system_wq, &work->irq_work);
> > +       }
> 
> Here I see potential issues with the object lifetime. 1) The memory is
> allocated here and what does guarantee its freeing? 2) What does
> guarantee that work will be not scheduled if the driver or its parts
> are gone?

You are right, if the driver is removed once the work is queued, then
that object will not be freed or even worst get NULL pointers.

A solution to this would be not to use system_wq but allocate own workqueue
and once the driver is removed, make sure to destroy it.
In this way we make sure that all the work is done.

> 
> --
> With Best Regards,
> Andy Shevchenko

-- 
/Horatiu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ