kernel_samsung_a53x/drivers/platform/x86
Armin Wolf df9b5e7379 platform/x86: wmi: Fix opening of char device
[ Upstream commit eba9ac7abab91c8f6d351460239108bef5e7a0b6 ]

Since commit fa1f68db6ca7 ("drivers: misc: pass miscdevice pointer via
file private data"), the miscdevice stores a pointer to itself inside
filp->private_data, which means that private_data will not be NULL when
wmi_char_open() is called. This might cause memory corruption should
wmi_char_open() be unable to find its driver, something which can
happen when the associated WMI device is deleted in wmi_free_devices().

Fix the problem by using the miscdevice pointer to retrieve the WMI
device data associated with a char device using container_of(). This
also avoids wmi_char_open() picking a wrong WMI device bound to a
driver with the same name as the original driver.

Fixes: 44b6b7661132 ("platform/x86: wmi: create userspace interface for drivers")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20231020211005.38216-5-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-18 11:42:54 +01:00
..
intel_speed_select_if Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
acer-wireless.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
acer-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
acerhdf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
alienware-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
amilo-rfkill.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
apple-gmux.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
asus-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
asus-nb-wmi.c platform/x86: asus-wmi: Map 0x2a code, Ignore 0x2b and 0x2c events 2024-11-08 11:26:20 +01:00
asus-wireless.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
asus-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
asus-wmi.h platform/x86: asus-wmi: Change ASUS_WMI_BRN_DOWN code from 0x20 to 0x2e 2024-11-08 11:26:20 +01:00
classmate-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
compal-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dcdbas.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dcdbas.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-rbtn.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-rbtn.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-smbios-base.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-smbios-smm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-smbios-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-smbios.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-smo8800.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-wmi-aio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-wmi-descriptor.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-wmi-descriptor.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-wmi-led.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dell_rbu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
eeepc-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
eeepc-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fujitsu-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fujitsu-tablet.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpd-pocket-fan.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hdaps.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hp-wireless.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hp-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hp_accel.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
huawei-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
i2c-multi-instantiate.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ibm_rtl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ideapad-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel-hid.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel-rst.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel-smartconnect.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel-uncore-frequency.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel-vbtn.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel-wmi-sbl-fw-update.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel-wmi-thunderbolt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_atomisp2_led.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_atomisp2_pm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_bxtwc_tmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_cht_int33fe_common.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_cht_int33fe_common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_cht_int33fe_microb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_cht_int33fe_typec.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_chtdc_ti_pwrbtn.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_int0002_vgpio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_ips.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_ips.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_menlow.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_mid_powerbtn.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_mid_thermal.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_mrfld_pwrbtn.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_oaktrail.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_pmc_core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_pmc_core.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_pmc_core_pltdrv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_punit_ipc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_scu_ipc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_scu_ipcutil.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_scu_pcidrv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_scu_pltdrv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_telemetry_core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_telemetry_debugfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_telemetry_pltdrv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel_turbo_max_3.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lg-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mlx-platform.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
msi-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
msi-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mxm-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
panasonic-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pcengines-apuv2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
peaq-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pmc_atom.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
samsung-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
samsung-q10.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sony-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
surface3-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
surface3_button.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
surface3_power.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
surfacepro3_button.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
system76_acpi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tc1100-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
thinkpad_acpi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
topstar-laptop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
toshiba-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
toshiba_acpi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
toshiba_bluetooth.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
toshiba_haps.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
touchscreen_dmi.c platform/x86: touchscreen_dmi: Add info for the Positivo C4128B 2024-11-08 11:26:17 +01:00
wmi-bmof.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
wmi.c platform/x86: wmi: Fix opening of char device 2024-11-18 11:42:54 +01:00
xiaomi-wmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xo1-rfkill.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xo15-ebook.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00