[PATCH v2 01/15] iio: inkern: only release the device node when done with it

Andy Shevchenko andy.shevchenko at gmail.com
Mon Jul 11 06:09:39 PDT 2022


On Mon, Jul 11, 2022 at 2:38 PM Nuno Sá <nuno.sa at analog.com> wrote:
>
> 'of_node_put()' can potentially release the memory pointed to by
> 'iiospec.np' which would leave us with an invalid pointer (and we would
> still pass it in 'of_xlate()'). Note that it is not guaranteed for the
> of_node lifespan to be attached to the device (to which is attached)
> lifespan so that there is (even though very unlikely) the possibility
> for the node to freed while the device is still around. Thus, as there

be freed

> are indeed some of_xlate users which do access the node, a possible race
> is indeed possible.

possible ... possible.

(I would drop the first one)

> As such, we can only release the node after we are done with it.

-- 
With Best Regards,
Andy Shevchenko



More information about the Linux-mediatek mailing list