Re: [PATCH v1 1/2] platform/x86: wmi: Break possible infinite loop when parsing GUID

From: Andy Shevchenko
Date: Thu Jun 22 2023 - 11:01:53 EST


On Thu, Jun 22, 2023 at 11:43:20AM +0300, Andy Shevchenko wrote:
> On Wed, Jun 21, 2023 at 11:50:51PM +0200, Armin Wolf wrote:

...

> I think that WARN_ON() is a bit bogus. First of all, it can be easily
> transformed to BUG()-equivalent with panic_on_oops and hence kill the
> entire system. If we need the message about wrong GUID format, it should
> be done elsewhere (modpost ?). I.o.w. we shan't expect that code,
> controlled by us, shoots to our foot.

Additional info. There will be another driver elsewhere that may use similar
API and also needs GUID in device ID table.

Looking into that implementation it seems that validation should be made in
file2alias.c for WMI and reused by that driver.

So, taking into account that we have no wrong IDs so far, I would drop
WARN_ON() here and guarantee that file2alias.c will be changed to validate
the GUID one way or the other.

Would it work? Hans, what is your comment here?

--
With Best Regards,
Andy Shevchenko