Re: [PATCH v3 02/24] firmware: arm_scmi: Reduce the scope of protocols mutex
From: Cristian Marussi
Date: Mon Jun 15 2026 - 03:49:51 EST
On Fri, Jun 12, 2026 at 03:15:24AM -0700, Usama Arif wrote:
> On Sun, 29 Mar 2026 17:33:13 +0100 Cristian Marussi <cristian.marussi@xxxxxxx> wrote:
>
> > Currently the mutex dedicated to the protection of the list of registered
> > protocols is held during all the protocol initialization phase.
> >
> > Such a wide locking region is not needed and causes problem when trying to
> > initialize notifications from within a protocol initialization routine.
> >
> > Reduce the scope of the protocol mutex.
>
> I think this changes more than the mutex scope. scmi_get_protocol_instance()
> can now drop protocols_mtx after idr_find() while scmi_protocol_release()
> can concurrently drop the final reference, remove the IDR entry, and release
> the devres group. Does that leaves a use-after-free window around the returned
> pi?
>
I have to review this mechanism in general in V5 so I will get back to
you on this once I have refreshed my memory on this own code of mine :P
Thanks,
Cristian