Skip to content

Commit 994e99a

Browse files
committed
Merge tag 'platform-drivers-x86-v5.8-2' of git://git.infradead.org/linux-platform-drivers-x86 into master
Pull x86 platform driver fixes from Andriy Shevchenko: "Small fixes for this cycle: - Fix procfs handling in Thinkpad ACPI driver - Fix battery management on new ASUS laptops - New IDs (Sapphire Rapids) in ISST tool" * tag 'platform-drivers-x86-v5.8-2' of git://git.infradead.org/linux-platform-drivers-x86: platform/x86: asus-wmi: allow BAT1 battery name platform/x86: ISST: Add new PCI device ids platform/x86: thinkpad_acpi: Revert "Use strndup_user() in dispatch_proc_write()"
2 parents 0665a4e + 9a33e37 commit 994e99a

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

drivers/platform/x86/asus-wmi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ static int asus_wmi_battery_add(struct power_supply *battery)
441441
* battery is named BATT.
442442
*/
443443
if (strcmp(battery->desc->name, "BAT0") != 0 &&
444+
strcmp(battery->desc->name, "BAT1") != 0 &&
444445
strcmp(battery->desc->name, "BATT") != 0)
445446
return -ENODEV;
446447

drivers/platform/x86/intel_speed_select_if/isst_if_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#define INTEL_RAPL_PRIO_DEVID_0 0x3451
1414
#define INTEL_CFG_MBOX_DEVID_0 0x3459
1515

16+
#define INTEL_RAPL_PRIO_DEVID_1 0x3251
17+
#define INTEL_CFG_MBOX_DEVID_1 0x3259
18+
1619
/*
1720
* Validate maximum commands in a single request.
1821
* This is enough to handle command to every core in one ioctl, or all

drivers/platform/x86/intel_speed_select_if/isst_if_mbox_pci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ static long isst_if_mbox_proc_cmd(u8 *cmd_ptr, int *write_only, int resume)
147147

148148
static const struct pci_device_id isst_if_mbox_ids[] = {
149149
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_CFG_MBOX_DEVID_0)},
150+
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_CFG_MBOX_DEVID_1)},
150151
{ 0 },
151152
};
152153
MODULE_DEVICE_TABLE(pci, isst_if_mbox_ids);

drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ static long isst_if_mmio_rd_wr(u8 *cmd_ptr, int *write_only, int resume)
7272

7373
static const struct pci_device_id isst_if_ids[] = {
7474
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_RAPL_PRIO_DEVID_0)},
75+
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_RAPL_PRIO_DEVID_1)},
7576
{ 0 },
7677
};
7778
MODULE_DEVICE_TABLE(pci, isst_if_ids);

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -885,11 +885,19 @@ static ssize_t dispatch_proc_write(struct file *file,
885885

886886
if (!ibm || !ibm->write)
887887
return -EINVAL;
888+
if (count > PAGE_SIZE - 1)
889+
return -EINVAL;
890+
891+
kernbuf = kmalloc(count + 1, GFP_KERNEL);
892+
if (!kernbuf)
893+
return -ENOMEM;
888894

889-
kernbuf = strndup_user(userbuf, PAGE_SIZE);
890-
if (IS_ERR(kernbuf))
891-
return PTR_ERR(kernbuf);
895+
if (copy_from_user(kernbuf, userbuf, count)) {
896+
kfree(kernbuf);
897+
return -EFAULT;
898+
}
892899

900+
kernbuf[count] = 0;
893901
ret = ibm->write(kernbuf);
894902
if (ret == 0)
895903
ret = count;

0 commit comments

Comments
 (0)