linux/drivers
Hans de Goede 71d69e82f4 platform/x86: think-lmi: Return EINVAL when kbdlang gets set to a 0 length string
Commit 0ddcf3a6b4 ("platform/x86: think-lmi: Avoid potential read before
start of the buffer") moved the length == 0 up to before stripping the '\n'
which typically gets added when users echo a value to a sysfs-attribute
from the shell.

This avoids a potential buffer-underrun, but it also causes a behavioral
change, prior to this change "echo > kbdlang", iow writing just a single
'\n' would result in an EINVAL error, but after the change this gets
accepted setting kbdlang to an empty string.

Fix this by replacing the manual '\n' check with using strchrnul() to get
the length till '\n' or terminating 0 in one go; and then do the
length != 0 check after this.

Fixes: 0ddcf3a6b4 ("platform/x86: think-lmi: Avoid potential read before start of the buffer")
Reported-by: Juha Leppänen <juha_efku@dnainternet.net>
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210621193648.44138-1-hdegoede@redhat.com
2021-06-22 11:42:31 +02:00
..
accessibility TTY/Serial driver updates for 5.13-rc1 2021-04-26 11:20:10 -07:00
acpi mfd: tps68470: Remove tps68470 MFD driver 2021-06-17 13:12:18 +02:00
amba
android binder: Return EFAULT if we fail BINDER_ENABLE_ONEWAY_SPAM_DETECTION 2021-05-13 20:35:26 +02:00
ata pci-v5.13-changes 2021-05-05 13:24:11 -07:00
atm atm: firestream: Use fallthrough pseudo-keyword 2021-05-07 16:01:08 -07:00
auxdisplay treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
base Driver core fixes for 5.13-rc2 2021-05-16 10:13:14 -07:00
bcma bcma: remove unused function 2021-04-18 09:36:56 +03:00
block block-5.13-2021-05-14 2021-05-15 08:52:30 -07:00
bluetooth Networking changes for 5.13. 2021-04-29 11:57:23 -07:00
bus ARM: SoC drivers for v5.13 2021-04-26 12:11:52 -07:00
cdrom cdrom: gdrom: initialize global variable at init time 2021-05-13 18:58:44 +02:00
char Char/misc driver fixes for 5.13-rc3 2021-05-20 06:31:52 -10:00
clk clk: Skip clk provider registration when np is NULL 2021-05-11 08:47:25 +02:00
clocksource clocksource/drivers/hyper-v: Re-enable VDSO_CLOCKMODE_HVCLOCK on X86 2021-05-14 14:55:13 +02:00
comedi staging: comedi: move out of staging directory 2021-04-15 09:26:25 +02:00
connector
counter
cpufreq Fix an idle CPU selection bug, and an AMD Ryzen maximum frequency enumeration bug. 2021-05-15 10:24:48 -07:00
cpuidle
crypto Revert "crypto: cavium/nitrox - add an error message to explain the failure of pci_request_mem_regions" 2021-05-13 17:23:05 +02:00
cxl cxl/mem: Fix memory device capacity probing 2021-04-16 18:21:56 -07:00
dax
dca
devfreq
dio
dma dmaengine: qcom_hidma: comment platform_driver_register call 2021-05-13 18:32:29 +02:00
dma-buf dma-buf: fix unintended pin/unpin warnings 2021-05-20 14:02:27 +02:00
edac x86/msr: Rename MSR_K8_SYSCFG to MSR_AMD64_SYSCFG 2021-05-10 07:51:38 +02:00
eisa
extcon extcon: extcon-max8997: Simplify driver using devm 2021-06-17 13:22:27 +02:00
firewire The usual updates from the irq departement: 2021-04-26 09:43:16 -07:00
firmware ARM: SoC fixes for 5.13 2021-05-20 14:46:26 -10:00
fpga ARM: SoC drivers for v5.13 2021-04-26 12:11:52 -07:00
fsi
gnss
gpio mfd: tps68470: Remove tps68470 MFD driver 2021-06-17 13:12:18 +02:00
gpu drm fixes for 5.13-rc3 2021-05-20 20:15:43 -10:00
greybus greybus: es2: fix kernel-doc warnings 2021-04-16 07:26:50 +02:00
hid Merge branch 'for-5.13/warnings' into for-linus 2021-04-29 21:47:22 +02:00
hsi HSI: core: fix resource leaks in hsi_add_client_from_dt() 2021-04-16 00:14:49 +02:00
hv printk changes for 5.13 2021-04-27 18:09:44 -07:00
hwmon Char/misc driver fixes for 5.13-rc3 2021-05-20 06:31:52 -10:00
hwspinlock
hwtracing ARM: 2021-05-01 10:14:08 -07:00
i2c ACPI: scan: Extend acpi_walk_dep_device_list() 2021-06-07 16:45:05 +02:00
i3c Revert "i3c master: fix missing destroy_workqueue() on error in i3c_master_register" 2021-04-24 22:21:01 +02:00
ide
idle
iio iio: tsl2583: Fix division by a zero lux_val 2021-05-10 14:01:48 +01:00
infiniband RDMA/uverbs: Fix a NULL vs IS_ERR() bug 2021-05-19 15:32:07 -03:00
input Input: goodix - platform/x86: touchscreen_dmi - Move upside down quirks to touchscreen_dmi.c 2021-05-20 15:17:07 +02:00
interconnect CFI on arm64 series for v5.13-rc1 2021-04-27 10:16:46 -07:00
iommu pci-v5.13-changes 2021-05-05 13:24:11 -07:00
ipack
irqchip irqchip: Remove redundant error printing 2021-05-16 13:07:18 +01:00
isdn isdn: mISDN: correctly handle ph_info allocation failure in hfcsusb_ph_info 2021-05-13 18:32:23 +02:00
leds leds: lp5523: check return value of lp5xx_read and jump to cleanup code 2021-05-13 17:30:15 +02:00
lightnvm
macintosh macintosh/via-pmu: Fix build warning 2021-04-16 23:57:51 +10:00
mailbox - qcom: enable support for SM8350 and SC7280 2021-04-28 16:10:33 -07:00
mcb
md dm integrity: fix sparse warnings 2021-05-13 14:53:49 -04:00
media media: gspca: properly check for errors in po1030_probe() 2021-05-13 18:58:32 +02:00
memory .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
memstick memstick: r592: ignore kfifo_out() return code again 2021-04-26 11:08:23 +02:00
message
mfd mfd: tps68470: Remove tps68470 MFD driver 2021-06-17 13:12:18 +02:00
misc platform-drivers-x86 for v5.13-2 2021-05-20 06:40:20 -10:00
mmc mmc: sdhci-pci-gli: increase 1.8V regulator wait 2021-05-10 14:39:06 +02:00
most Staging/IIO driver updates for 5.13-rc1 2021-04-26 11:14:21 -07:00
mtd This pull request contains changes for JFFS2, UBI and UBIFS 2021-05-04 18:08:40 -07:00
mux
net brcmfmac: properly check for bus register errors 2021-05-13 18:58:42 +02:00
nfc
ntb
nubus
nvdimm include: remove pagemap.h from blkdev.h 2021-05-06 19:24:11 -07:00
nvme nvme-fc: clear q_live at beginning of association teardown 2021-05-19 08:40:24 +02:00
nvmem
of of: overlay: Remove redundant assignment to ret 2021-05-03 13:57:56 -05:00
opp
parisc
parport treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
pci more s390 updates for 5.13 merge window 2021-05-06 14:39:50 -07:00
pcmcia
perf ARM: 2021-05-01 10:14:08 -07:00
phy Networking changes for 5.13. 2021-04-29 11:57:23 -07:00
pinctrl linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in <linux/kernel.h> 2021-05-09 00:29:45 +09:00
platform platform/x86: think-lmi: Return EINVAL when kbdlang gets set to a 0 length string 2021-06-22 11:42:31 +02:00
pnp
power power supply and reset changes for the v5.13 series 2021-04-28 15:43:58 -07:00
powercap
pps TTY/Serial driver updates for 5.13-rc1 2021-04-26 11:20:10 -07:00
ps3
ptp ARM: 2021-05-01 10:14:08 -07:00
pwm pwm: Changes for v5.13-rc1 2021-05-05 12:53:16 -07:00
rapidio rapidio: handle create_workqueue() failure 2021-05-13 18:32:19 +02:00
ras
regulator - Core Frameworks 2021-04-28 15:59:13 -07:00
remoteproc remoteproc updates for v5.13 2021-05-04 11:13:33 -07:00
reset pci-v5.13-changes 2021-05-05 13:24:11 -07:00
rpmsg
rtc RTC for 5.13 2021-05-03 12:15:21 -07:00
s390 block-5.13-2021-05-07 2021-05-07 11:35:12 -07:00
sbus
scsi SCSI fixes on 20210520 2021-05-20 14:41:35 -10:00
sh The usual updates from the irq departement: 2021-04-26 09:43:16 -07:00
siox
slimbus
soc IOMMU Updates for Linux v5.13 2021-05-01 09:33:00 -07:00
soundwire
spi sound updates for 5.13 2021-04-30 12:48:14 -07:00
spmi
ssb
staging staging: rtl8723bs: avoid bogus gcc warning 2021-05-10 14:26:24 +02:00
target SCSI misc on 20210508 2021-05-08 10:44:36 -07:00
tc
tee AMD-TEE reference count loaded TAs 2021-05-17 16:06:02 +02:00
thermal - Remove duplicate error message for the amlogic driver (Tang Bin) 2021-05-05 12:46:48 -07:00
thunderbolt
tty Char/misc driver fixes for 5.13-rc3 2021-05-20 06:31:52 -10:00
uio uio_hv_generic: Fix another memory leak in error handling paths 2021-05-14 13:26:04 +02:00
usb Driver core fixes for 5.13-rc2 2021-05-16 10:13:14 -07:00
vdpa vDPA/ifcvf: get_config_size should return dev specific config size 2021-05-03 04:55:54 -04:00
vfio IOMMU Updates for Linux v5.13 2021-05-01 09:33:00 -07:00
vhost virtio,vhost,vdpa: features, fixes 2021-05-05 13:31:39 -07:00
video Char/misc driver fixes for 5.13-rc3 2021-05-20 06:31:52 -10:00
virt nitro_enclaves: Fix stale file descriptors on failed usercopy 2021-04-29 19:06:49 +02:00
virtio virtio_pci_modern: correct sparse tags for notify 2021-05-04 04:19:59 -04:00
visorbus
vlynq
vme
w1
watchdog - Core Frameworks 2021-04-28 15:59:13 -07:00
xen xen-pciback: reconfigure also from backend watch handler 2021-05-21 09:55:16 +02:00
zorro
Kconfig staging: comedi: move out of staging directory 2021-04-15 09:26:25 +02:00
Makefile virtio,vhost,vdpa: features, fixes 2021-05-05 13:31:39 -07:00