<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/platform/x86/wmi.c, branch linux-4.20.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.20.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.20.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2018-10-31T14:11:39Z</updated>
<entry>
<title>platform/x86: wmi: declare device_type structure as constant</title>
<updated>2018-10-31T14:11:39Z</updated>
<author>
<name>Bhumika Goyal</name>
</author>
<published>2018-10-28T06:07:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=69372c1dbdee8cab3c3892eda932c624af59a494'/>
<id>urn:sha1:69372c1dbdee8cab3c3892eda932c624af59a494</id>
<content type='text'>
The only usage of device_type structure is getting stored as
a reference in the type field of device structure. This type
field is declared const. Therefore, the device_type structure
can never be modified and can be declared as const.

Signed-off-by: Bhumika Goyal &lt;bhumirks@gmail.com&gt;
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>platform/x86: wmi: Do not mix pages and kmalloc</title>
<updated>2018-06-22T23:24:40Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2018-06-20T21:31:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6fb741076a9fc53355e56dff2e2b46782b3a46d3'/>
<id>urn:sha1:6fb741076a9fc53355e56dff2e2b46782b3a46d3</id>
<content type='text'>
The probe handler_data was being allocated with __get_free_pages()
for no reason I could find. The error path was using kfree(). Since
other things are happily using kmalloc() in the probe path, switch to
kmalloc() entirely. This fixes the error path mismatch and will avoid
issues with CONFIG_HARDENED_USERCOPY_PAGESPAN=y.

Reported-by: Mihai Donțu &lt;mihai.dontu@gmail.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: Mario Limonciello &lt;Mario.limonciello@dell.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Darren Hart (VMware) &lt;dvhart@infradead.org&gt;
</content>
</entry>
<entry>
<title>platform/x86: wmi: Fix misuse of vsprintf extension %pULL</title>
<updated>2018-03-01T17:57:04Z</updated>
<author>
<name>Joe Perches</name>
</author>
<published>2018-03-01T16:08:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=501f7e52de8a7b910154740958ce8d902258bf72'/>
<id>urn:sha1:501f7e52de8a7b910154740958ce8d902258bf72</id>
<content type='text'>
%pULL doesn't officially exist but %pUL does.

Miscellanea:

o Add missing newlines to a couple logging messages

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Darren Hart (VMware) &lt;dvhart@infradead.org&gt;
</content>
</entry>
<entry>
<title>platform/x86: wmi: Replace list_for_each() by list_for_each_entry()</title>
<updated>2018-02-23T16:43:39Z</updated>
<author>
<name>Andy Shevchenko</name>
</author>
<published>2018-02-19T15:02:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cedb3b2a7d7cb059b3646db14dfe2f833bf4d52d'/>
<id>urn:sha1:cedb3b2a7d7cb059b3646db14dfe2f833bf4d52d</id>
<content type='text'>
In all cases list_for_each() followed by list_entry(),
so, replace them by list_for_each_entry() macro.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Reviewed-by: Darren Hart (VMware) &lt;dvhart@infradead.org&gt;
</content>
</entry>
<entry>
<title>platform/x86: wmi: Replace kmalloc + sprintf() with kasprintf()</title>
<updated>2018-02-19T15:03:43Z</updated>
<author>
<name>Andy Shevchenko</name>
</author>
<published>2018-02-16T15:40:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7f166addbebdcaeefe36997d5b8dceb96c5619fa'/>
<id>urn:sha1:7f166addbebdcaeefe36997d5b8dceb96c5619fa</id>
<content type='text'>
kasprintf() does the job of two: kmalloc() and sprintf().
Replace two calls with one.

Reviewed-by: Darren Hart (VMware) &lt;dvhart@infradead.org&gt;
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>platform/x86: wmi: fix off-by-one write in wmi_dev_probe()</title>
<updated>2018-02-15T10:18:32Z</updated>
<author>
<name>Andrey Ryabinin</name>
</author>
<published>2018-02-14T11:55:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6e1d8ea90932f77843730ada0bfea63093b7212a'/>
<id>urn:sha1:6e1d8ea90932f77843730ada0bfea63093b7212a</id>
<content type='text'>
wmi_dev_probe() allocates one byte less than necessary, thus
subsequent sprintf() call writes trailing zero past the end
of the 'buf':

    BUG: KASAN: slab-out-of-bounds in vsnprintf+0xda4/0x1240
    Write of size 1 at addr ffff880423529caf by task kworker/1:1/32

    Call Trace:
     dump_stack+0xb3/0x14d
     print_address_description+0xd7/0x380
     kasan_report+0x166/0x2b0
     vsnprintf+0xda4/0x1240
     sprintf+0x9b/0xd0
     wmi_dev_probe+0x1c3/0x400
     driver_probe_device+0x5d1/0x990
     bus_for_each_drv+0x109/0x190
     __device_attach+0x217/0x360
     bus_probe_device+0x1ad/0x260
     deferred_probe_work_func+0x10f/0x5d0
     process_one_work+0xa8b/0x1dc0
     worker_thread+0x20d/0x17d0
     kthread+0x311/0x3d0
     ret_from_fork+0x3a/0x50

    Allocated by task 32:
     kasan_kmalloc+0xa0/0xd0
     __kmalloc+0x14f/0x3e0
     wmi_dev_probe+0x182/0x400
     driver_probe_device+0x5d1/0x990
     bus_for_each_drv+0x109/0x190
     __device_attach+0x217/0x360
     bus_probe_device+0x1ad/0x260
     deferred_probe_work_func+0x10f/0x5d0
     process_one_work+0xa8b/0x1dc0
     worker_thread+0x20d/0x17d0
     kthread+0x311/0x3d0
     ret_from_fork+0x3a/0x50

Increment allocation size to fix this.

Fixes: 44b6b7661132 ("platform/x86: wmi: create userspace interface for drivers")
Signed-off-by: Andrey Ryabinin &lt;aryabinin@virtuozzo.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>platform/x86: wmi: Call acpi_wmi_init() later</title>
<updated>2018-01-08T18:47:48Z</updated>
<author>
<name>Rafael J. Wysocki</name>
</author>
<published>2018-01-03T11:49:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=98b8e4e5c17bf87c1b18ed929472051dab39878c'/>
<id>urn:sha1:98b8e4e5c17bf87c1b18ed929472051dab39878c</id>
<content type='text'>
Calling acpi_wmi_init() at the subsys_initcall() level causes ordering
issues to appear on some systems and they are difficult to reproduce,
because there is no guaranteed ordering between subsys_initcall()
calls, so they may occur in different orders on different systems.

In particular, commit 86d9f48534e8 (mm/slab: fix kmemcg cache
creation delayed issue) exposed one of these issues where genl_init()
and acpi_wmi_init() are both called at the same initcall level, but
the former must run before the latter so as to avoid a NULL pointer
dereference.

For this reason, move the acpi_wmi_init() invocation to the
initcall_sync level which should still be early enough for things
to work correctly in the WMI land.

Link: https://marc.info/?t=151274596700002&amp;r=1&amp;w=2
Reported-by: Jonathan McDowell &lt;noodles@earth.li&gt;
Reported-by: Joonsoo Kim &lt;iamjoonsoo.kim@lge.com&gt;
Tested-by: Jonathan McDowell &lt;noodles@earth.li&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Darren Hart (VMware) &lt;dvhart@infradead.org&gt;
</content>
</entry>
<entry>
<title>platform/x86: wmi: release mutex on module acquistion failure</title>
<updated>2017-11-08T20:58:36Z</updated>
<author>
<name>Mario Limonciello</name>
</author>
<published>2017-11-06T03:34:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5e3e22971fb0b0d7d03286f1a619d0348748a243'/>
<id>urn:sha1:5e3e22971fb0b0d7d03286f1a619d0348748a243</id>
<content type='text'>
This failure mode should have also released the mutex.

Signed-off-by: Mario Limonciello &lt;mario.limonciello@dell.com&gt;
Signed-off-by: Darren Hart (VMware) &lt;dvhart@infradead.org&gt;
</content>
</entry>
<entry>
<title>platform/x86: wmi: create userspace interface for drivers</title>
<updated>2017-11-03T23:34:00Z</updated>
<author>
<name>Mario Limonciello</name>
</author>
<published>2017-11-01T19:25:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=44b6b7661132b1b0e5fd3147ded66f1e4a817ca9'/>
<id>urn:sha1:44b6b7661132b1b0e5fd3147ded66f1e4a817ca9</id>
<content type='text'>
For WMI operations that are only Set or Query readable and writable sysfs
attributes created by WMI vendor drivers or the bus driver makes sense.

For other WMI operations that are run on Method, there needs to be a
way to guarantee to userspace that the results from the method call
belong to the data request to the method call.  Sysfs attributes don't
work well in this scenario because two userspace processes may be
competing at reading/writing an attribute and step on each other's
data.

When a WMI vendor driver declares a callback method in the wmi_driver
the WMI bus driver will create a character device that maps to that
function.  This callback method will be responsible for filtering
invalid requests and performing the actual call.

That character device will correspond to this path:
/dev/wmi/$driver

Performing read() on this character device will provide the size
of the buffer that the character device needs to perform calls.
This buffer size can be set by vendor drivers through a new symbol
or when MOF parsing is available by the MOF.

Performing ioctl() on this character device will be interpretd
by the WMI bus driver. It will perform sanity tests for size of
data, test them for a valid instance, copy the data from userspace
and pass iton to the vendor driver to further process and run.

This creates an implicit policy that each driver will only be allowed
a single character device.  If a module matches multiple GUID's,
the wmi_devices will need to be all handled by the same wmi_driver.

The WMI vendor drivers will be responsible for managing inappropriate
access to this character device and proper locking on data used by
it.

When a WMI vendor driver is unloaded the WMI bus driver will clean
up the character device and any memory allocated for the call.

Signed-off-by: Mario Limonciello &lt;mario.limonciello@dell.com&gt;
Reviewed-by: Edward O'Callaghan &lt;quasisec@google.com&gt;
Signed-off-by: Darren Hart (VMware) &lt;dvhart@infradead.org&gt;
</content>
</entry>
<entry>
<title>platform/x86: wmi: Don't allow drivers to get each other's GUIDs</title>
<updated>2017-11-03T23:33:58Z</updated>
<author>
<name>Mario Limonciello</name>
</author>
<published>2017-11-01T19:25:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f97e058cfe8032504e310bd5c20e35d640ef2858'/>
<id>urn:sha1:f97e058cfe8032504e310bd5c20e35d640ef2858</id>
<content type='text'>
The only driver using this was dell-wmi, and it really was a hack.
The driver was getting a data attribute from another driver and this
type of action should not be encouraged.

Rather drivers that need to interact with one another should pass
data back and forth via exported functions.

Signed-off-by: Mario Limonciello &lt;mario.limonciello@dell.com&gt;
Reviewed-by: Edward O'Callaghan &lt;quasisec@google.com&gt;
Reviewed-by: Pali Rohár &lt;pali.rohar@gmail.com&gt;
Signed-off-by: Darren Hart (VMware) &lt;dvhart@infradead.org&gt;
</content>
</entry>
</feed>
