Re: [PATCH] platform/chrome: cros_ec_proto: Lock device when updating MKBP version

From: Tzung-Bi Shih
Date: Tue Jul 30 2024 - 06:14:32 EST


On Tue, Jul 30, 2024 at 10:05:16AM +0200, Patryk Duda wrote:
> On Tue, Jul 30, 2024 at 8:04 AM Tzung-Bi Shih <tzungbi@xxxxxxxxxx> wrote:
> > On Mon, Jul 29, 2024 at 01:57:09PM +0200, Patryk Duda wrote:
> > > On Mon, Jul 29, 2024 at 5:47 AM Tzung-Bi Shih <tzungbi@xxxxxxxxxx> wrote:
> > > > Also, the patch also needs an unlock at [1].
> > > >
> > > > [1]: https://elixir.bootlin.com/linux/v6.10/source/drivers/platform/chrome/cros_ec_proto.c#L819
> > >
> > > Yeah. I'll fix it in v2
> >
> > I'm wondering if it's simpler to just lock and unlock around calling
> > cros_ec_get_host_command_version_mask(). What do you think?
> >
> Initially, I thought it would be good to keep ec_dev->mkbp_event_supported
> update under the mutex (similar to cros_ec_query_all() which is called with
> locked mutex), but mkbp_event_supported is also used without locked mutex.
>
> I don't see any obvious risks with updating the MKBP version outside mutex.
> Do you want me to change it?

Yes.