platform-drivers-x86 for v4.15-2

Fix two issues resulting from the dell-smbios refactoring and
 introduction of the dell-smbios-wmi dispatcher. The first ensures a
 proper error code is returned when kzalloc fails. The second avoids an
 issue in older Dell BIOS implementations which would fail if the more
 complex calls were made by limiting those platforms to the simple calls
 such as those used by the existing dell-laptop and dell-wmi drivers,
 preserving their functionality prior to the addition of the
 dell-smbios-wmi dispatcher.
 
 The following is an automated git shortlog grouped by driver:
 
 dell-laptop:
  -  Fix error return code in dell_init()
 
 dell-smbios-wmi:
  -  Disable userspace interface if missing hotfix
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJaFg4hAAoJEKbMaAwKp3647McIALuFgfx4WCM0QDlvvvyyjayv
 WtGcxGOgafPEVuHn5OyTIOYNlko009uhV/Y3D+F4/Fo4Q3zu3iBu479BALBXr9Uj
 OEkFxdJnrSTCpExsBDuCOEpB1eLvr2ceWF7KAmWR7cktLCtd6E7vNzLF/VOdiC/z
 yGvuAwQtMvX3RnR0DWFcx4qJPDyIZCQJ0HLYlTG6mPjR5YkyOkxhKnmIj+ljU5jV
 M7/yBH8EpI6YLjN0uGdWXHYiEp45OX5CJMSHGvKI6KE5s+6dy1r5fJWw/FLSSGgv
 wxBiuQuDGeDdqcKBCEAZ4fedvbQRJdSUlY/ZDgWtBzpSY/AdCexyY5zAR0XVxos=
 =NK+B
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v4.15-2' of git://git.infradead.org/linux-platform-drivers-x86

Pull x86 platform driver fixes from Darren Hart:
 "Fix two issues resulting from the dell-smbios refactoring and
  introduction of the dell-smbios-wmi dispatcher.

  The first ensures a proper error code is returned when kzalloc fails.

  The second avoids an issue in older Dell BIOS implementations which
  would fail if the more complex calls were made by limiting those
  platforms to the simple calls such as those used by the existing
  dell-laptop and dell-wmi drivers, preserving their functionality prior
  to the addition of the dell-smbios-wmi dispatcher"

* tag 'platform-drivers-x86-v4.15-2' of git://git.infradead.org/linux-platform-drivers-x86:
  platform/x86: dell-laptop: fix error return code in dell_init()
  platform/x86: dell-smbios-wmi: Disable userspace interface if missing hotfix
This commit is contained in:
Linus Torvalds 2017-11-23 21:14:30 -10:00
Родитель 06c944005b c6f9288ee4
Коммит 36f20ee24b
4 изменённых файлов: 41 добавлений и 3 удалений

Просмотреть файл

@ -2074,8 +2074,10 @@ static int __init dell_init(void)
goto fail_platform_device2;
buffer = kzalloc(sizeof(struct calling_interface_buffer), GFP_KERNEL);
if (!buffer)
if (!buffer) {
ret = -ENOMEM;
goto fail_buffer;
}
ret = dell_setup_rfkill();

Просмотреть файл

@ -147,7 +147,10 @@ fail_smbios_cmd:
static int dell_smbios_wmi_probe(struct wmi_device *wdev)
{
struct wmi_driver *wdriver =
container_of(wdev->dev.driver, struct wmi_driver, driver);
struct wmi_smbios_priv *priv;
u32 hotfix;
int count;
int ret;
@ -164,6 +167,16 @@ static int dell_smbios_wmi_probe(struct wmi_device *wdev)
if (!dell_wmi_get_size(&priv->req_buf_size))
return -EPROBE_DEFER;
/* some SMBIOS calls fail unless BIOS contains hotfix */
if (!dell_wmi_get_hotfix(&hotfix))
return -EPROBE_DEFER;
if (!hotfix) {
dev_warn(&wdev->dev,
"WMI SMBIOS userspace interface not supported(%u), try upgrading to a newer BIOS\n",
hotfix);
wdriver->filter_callback = NULL;
}
/* add in the length object we will use internally with ioctl */
priv->req_buf_size += sizeof(u64);
ret = set_required_buffer_size(wdev, priv->req_buf_size);

Просмотреть файл

@ -27,6 +27,7 @@ struct descriptor_priv {
struct list_head list;
u32 interface_version;
u32 size;
u32 hotfix;
};
static int descriptor_valid = -EPROBE_DEFER;
static LIST_HEAD(wmi_list);
@ -77,6 +78,24 @@ bool dell_wmi_get_size(u32 *size)
}
EXPORT_SYMBOL_GPL(dell_wmi_get_size);
bool dell_wmi_get_hotfix(u32 *hotfix)
{
struct descriptor_priv *priv;
bool ret = false;
mutex_lock(&list_mutex);
priv = list_first_entry_or_null(&wmi_list,
struct descriptor_priv,
list);
if (priv) {
*hotfix = priv->hotfix;
ret = true;
}
mutex_unlock(&list_mutex);
return ret;
}
EXPORT_SYMBOL_GPL(dell_wmi_get_hotfix);
/*
* Descriptor buffer is 128 byte long and contains:
*
@ -85,6 +104,7 @@ EXPORT_SYMBOL_GPL(dell_wmi_get_size);
* Object Signature 4 4 " WMI"
* WMI Interface Version 8 4 <version>
* WMI buffer length 12 4 <length>
* WMI hotfix number 16 4 <hotfix>
*/
static int dell_wmi_descriptor_probe(struct wmi_device *wdev)
{
@ -144,15 +164,17 @@ static int dell_wmi_descriptor_probe(struct wmi_device *wdev)
priv->interface_version = buffer[2];
priv->size = buffer[3];
priv->hotfix = buffer[4];
ret = 0;
dev_set_drvdata(&wdev->dev, priv);
mutex_lock(&list_mutex);
list_add_tail(&priv->list, &wmi_list);
mutex_unlock(&list_mutex);
dev_dbg(&wdev->dev, "Detected Dell WMI interface version %lu and buffer size %lu\n",
dev_dbg(&wdev->dev, "Detected Dell WMI interface version %lu, buffer size %lu, hotfix %lu\n",
(unsigned long) priv->interface_version,
(unsigned long) priv->size);
(unsigned long) priv->size,
(unsigned long) priv->hotfix);
out:
kfree(obj);

Просмотреть файл

@ -23,5 +23,6 @@ int dell_wmi_get_descriptor_valid(void);
bool dell_wmi_get_interface_version(u32 *version);
bool dell_wmi_get_size(u32 *size);
bool dell_wmi_get_hotfix(u32 *hotfix);
#endif