From: "Pali Rohár" <pali.rohar@gmail.com>
To: Mario.Limonciello@dell.com
Cc: dvhart@infradead.org, andy.shevchenko@gmail.com,
linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org, luto@kernel.org,
quasisec@google.com
Subject: Re: [PATCH v3 3/8] platform/x86: dell-wmi-smbios: Use Dell WMI descriptor check
Date: Mon, 2 Oct 2017 16:37:54 +0200 [thread overview]
Message-ID: <20171002143754.GH10938@pali> (raw)
In-Reply-To: <42642a2d212b493db280c7bac6d50564@ausx13mpc120.AMER.DELL.COM>
On Monday 02 October 2017 14:15:11 Mario.Limonciello@dell.com wrote:
> > -----Original Message-----
> > From: Pali Rohár [mailto:pali.rohar@gmail.com]
> > Sent: Saturday, September 30, 2017 3:01 PM
> > To: Limonciello, Mario <Mario_Limonciello@Dell.com>
> > Cc: dvhart@infradead.org; andy.shevchenko@gmail.com; linux-
> > kernel@vger.kernel.org; platform-driver-x86@vger.kernel.org; luto@kernel.org;
> > quasisec@google.com
> > Subject: Re: [PATCH v3 3/8] platform/x86: dell-wmi-smbios: Use Dell WMI
> > descriptor check
> >
> > On Saturday 30 September 2017 21:48:39 Mario.Limonciello@dell.com wrote:
> > > > > +/*
> > > >
> > > > > + * Descriptor buffer is 128 byte long and contains:
> > > > ...
> > > >
> > > > > + if (obj->buffer.length != 128) {
> > > > > + dev_err(&wdev->dev,
> > > > > + "Dell descriptor buffer has invalid length (%d)\n",
> > > > > + obj->buffer.length);
> > > >
> > > > This seems odd. We call it an error (not a warning) if != 128, but
> > > > we only abort and return an error if it's < 16.
> > > >
> > > > If it's an error, we should return an error code, if anything above
> > > > 16 is acceptable but 128 is preferred, the above should be a
> > > > warning at best. (this scenario seems unlikely).
> > >
> > > Hopefully the original author can speak up to the intentions here. I
> > > would feel that it should have errored out if it wasn't expected
> > > length too.
> >
> > Code below access first 16 bytes of buffer. Therefore to prevent buffer
> > overflow check for 16 bytes is needed.
> >
> > But IIRC we decided to do not throw error and continue driver loading
> > even when buffer length is not 128 (as expected by some Dell
> > documentation) as it could be possible regression because driver itself
> > does not depend on buffer length.
> >
>
> So I'm intending to change this in my next patch series. I feel it should throw an
> error when the buffer length isn't 128.
>
> My logic is that if you don't see the proper buffer size (or the proper header)
> then how can you trust that the rest of the data is reliable? This means the format
> has changed or this isn't a real descriptor as expected by Dell (say some other vendor
> that has cloned the GUID). It's better to abort in this situation.
Error handling now is up to you -- Dell. You know the best how your
API/ABI behave.
I did that change to be fully backward compatible with possibility to
read interface version number (needed for event handling logic).
> > > > > + if (obj->buffer.length < 16) {
> > > > > + ret = -EINVAL;
> > > > > + goto out;
> > > > > + }
> > > > > + }
> > > > > + desc_buffer = (u32 *)obj->buffer.pointer;
> > > > > +
> > > > > + if (desc_buffer[0] != 0x4C4C4544 && desc_buffer[1] !=
> > > > > 0x494D5720)
> >
> > --
> > Pali Rohár
> > pali.rohar@gmail.com
--
Pali Rohár
pali.rohar@gmail.com
next prev parent reply other threads:[~2017-10-02 14:37 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 4:02 [PATCH v3 0/8] Introduce support for Dell SMBIOS over WMI Mario Limonciello
2017-09-28 4:02 ` [PATCH v3 1/8] platform/x86: wmi: Add new method wmidev_evaluate_method Mario Limonciello
2017-09-28 4:02 ` [PATCH v3 2/8] platform/x86: dell-smbios: Introduce a WMI-ACPI interface Mario Limonciello
2017-09-28 6:53 ` Pali Rohár
2017-09-28 22:43 ` Mario.Limonciello
2017-09-28 22:43 ` Mario.Limonciello
2017-09-29 7:35 ` Pali Rohár
2017-09-30 20:01 ` Mario.Limonciello
2017-09-30 20:01 ` Mario.Limonciello
2017-09-30 21:06 ` Pali Rohár
2017-09-30 0:51 ` Darren Hart
2017-09-30 7:15 ` Pali Rohár
2017-09-30 19:56 ` Mario.Limonciello
2017-09-30 19:56 ` Mario.Limonciello
2017-09-28 4:02 ` [PATCH v3 3/8] platform/x86: dell-wmi-smbios: Use Dell WMI descriptor check Mario Limonciello
2017-09-30 1:29 ` Darren Hart
2017-09-30 19:48 ` Mario.Limonciello
2017-09-30 19:48 ` Mario.Limonciello
2017-09-30 20:01 ` Pali Rohár
2017-10-02 14:15 ` Mario.Limonciello
2017-10-02 14:15 ` Mario.Limonciello
2017-10-02 14:37 ` Pali Rohár [this message]
2017-10-01 8:43 ` Andy Shevchenko
2017-09-28 4:02 ` [PATCH v3 4/8] platform/x86: wmi: create character devices when requested by drivers Mario Limonciello
2017-09-30 1:52 ` Darren Hart
2017-09-30 8:12 ` Greg Kroah-Hartman
2017-09-30 19:26 ` Mario.Limonciello
2017-09-30 19:26 ` Mario.Limonciello
2017-10-01 13:23 ` Greg KH
2017-10-01 14:25 ` Mario.Limonciello
2017-10-01 14:25 ` Mario.Limonciello
2017-10-01 18:03 ` Greg KH
2017-10-02 0:57 ` Darren Hart
2017-10-02 9:24 ` Greg Kroah-Hartman
2017-10-02 14:33 ` Darren Hart
2017-10-03 9:23 ` Greg KH
2017-10-03 15:09 ` Mario.Limonciello
2017-10-03 15:09 ` Mario.Limonciello
2017-10-03 15:10 ` Darren Hart
2017-10-03 16:48 ` Andy Lutomirski
2017-10-03 17:46 ` Greg KH
2017-10-03 18:38 ` Mario.Limonciello
2017-10-03 18:38 ` Mario.Limonciello
2017-10-03 19:31 ` Andy Lutomirski
2017-10-03 9:23 ` Greg KH
2017-10-03 15:13 ` Mario.Limonciello
2017-10-03 15:13 ` Mario.Limonciello
2017-09-28 4:02 ` [PATCH v3 5/8] platform/x86: dell-wmi-smbios: introduce character device for userspace Mario Limonciello
2017-09-30 2:06 ` Darren Hart
2017-09-30 19:45 ` Mario.Limonciello
2017-09-30 19:45 ` Mario.Limonciello
2017-10-03 9:26 ` Greg KH
2017-10-03 15:09 ` Mario.Limonciello
2017-10-03 15:09 ` Mario.Limonciello
2017-10-03 15:20 ` Darren Hart
2017-10-03 15:49 ` Mario.Limonciello
2017-10-03 15:49 ` Mario.Limonciello
2017-10-05 0:02 ` Darren Hart
2017-10-05 15:10 ` Mario.Limonciello
2017-10-05 15:10 ` Mario.Limonciello
2017-09-28 4:02 ` [PATCH v3 6/8] platform/x86: dell-wmi-smbios: Add a sysfs interface for SMBIOS tokens Mario Limonciello
2017-09-30 2:10 ` Darren Hart
2017-10-01 8:51 ` Andy Shevchenko
2017-09-28 4:02 ` [PATCH v3 7/8] platform/x86: Kconfig: Change the default settings for dell-wmi-smbios Mario Limonciello
2017-09-28 4:02 ` [PATCH v3 8/8] platform/x86: dell-wmi-smbios: clean up wmi descriptor check Mario Limonciello
2017-10-02 13:15 ` Andy Shevchenko
2017-10-02 13:26 ` Mario.Limonciello
2017-10-02 13:26 ` Mario.Limonciello
2017-09-30 2:16 ` [PATCH v3 0/8] Introduce support for Dell SMBIOS over WMI Darren Hart
2017-09-30 19:56 ` Mario.Limonciello
2017-09-30 19:56 ` Mario.Limonciello
2017-10-05 2:44 ` Darren Hart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171002143754.GH10938@pali \
--to=pali.rohar@gmail.com \
--cc=Mario.Limonciello@dell.com \
--cc=andy.shevchenko@gmail.com \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=quasisec@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.