linux-stable/drivers/hwmon
Guenter Roeck 79da533d3c hwmon: (nct6775) Fix crash in clear_caseopen
Paweł Marciniak reports the following crash, observed when clearing
the chassis intrusion alarm.

BUG: kernel NULL pointer dereference, address: 0000000000000028
PGD 0 P4D 0
Oops: 0000 [#1] PREEMPT SMP PTI
CPU: 3 PID: 4815 Comm: bash Tainted: G S                5.16.2-200.fc35.x86_64 #1
Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./Z97 Extreme4, BIOS P2.60A 05/03/2018
RIP: 0010:clear_caseopen+0x5a/0x120 [nct6775]
Code: 68 70 e8 e9 32 b1 e3 85 c0 0f 85 d2 00 00 00 48 83 7c 24 ...
RSP: 0018:ffffabcb02803dd8 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000
RDX: ffff8e8808192880 RSI: 0000000000000000 RDI: ffff8e87c7509a68
RBP: 0000000000000000 R08: 0000000000000001 R09: 000000000000000a
R10: 000000000000000a R11: f000000000000000 R12: 000000000000001f
R13: ffff8e87c7509828 R14: ffff8e87c7509a68 R15: ffff8e88494527a0
FS:  00007f4db9151740(0000) GS:ffff8e8ebfec0000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000028 CR3: 0000000166b66001 CR4: 00000000001706e0
Call Trace:
 <TASK>
 kernfs_fop_write_iter+0x11c/0x1b0
 new_sync_write+0x10b/0x180
 vfs_write+0x209/0x2a0
 ksys_write+0x4f/0xc0
 do_syscall_64+0x3b/0x90
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The problem is that the device passed to clear_caseopen() is the hwmon
device, not the platform device, and the platform data is not set in the
hwmon device. Store the pointer to sio_data in struct nct6775_data and
get if from there if needed.

Fixes: 2e7b988696 ("hwmon: (nct6775) Use superio_*() function pointers in sio_data.")
Cc: Denis Pauk <pauk.denis@gmail.com>
Cc: Bernhard Seibold <mail@bernhard-seibold.de>
Reported-by: Paweł Marciniak <pmarciniak@lodz.home.pl>
Tested-by: Denis Pauk <pauk.denis@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-01-24 14:32:47 -08:00
..
occ
pmbus hwmon: (pmbus/ir38064) Mark ir38064_of_match as __maybe_unused 2022-01-23 18:21:27 -08:00
abituguru.c
abituguru3.c
acpi_power_meter.c
ad7314.c
ad7414.c
ad7418.c
adc128d818.c
adcxx.c
adm1021.c
adm1025.c
adm1026.c
adm1029.c
adm1031.c
adm1177.c
adm9240.c
ads7828.c
ads7871.c
adt7x10.c
adt7x10.h
adt7310.c
adt7410.c
adt7411.c
adt7462.c
adt7470.c hwmon: (adt7470) Prevent divide by zero in adt7470_fan_write() 2022-01-23 18:21:27 -08:00
adt7475.c
aht10.c
amc6821.c
applesmc.c
aquacomputer_d5next.c
as370-hwmon.c
asb100.c
asc7621.c
aspeed-pwm-tacho.c
asus_atk0110.c
asus_wmi_ec_sensors.c
asus_wmi_sensors.c
atxp1.c
axi-fan-control.c
bt1-pvt.c
bt1-pvt.h
coretemp.c
corsair-cpro.c
corsair-psu.c
da9052-hwmon.c
da9055-hwmon.c
dell-smm-hwmon.c
dme1737.c
drivetemp.c
ds620.c
ds1621.c
emc6w201.c
emc1403.c
emc2103.c
f71805f.c
f71882fg.c
f75375s.c
fam15h_power.c
fschmd.c
ftsteutates.c
g760a.c
g762.c
gl518sm.c
gl520sm.c
gpio-fan.c
gsc-hwmon.c
hih6130.c
hwmon-vid.c
hwmon.c
i5k_amb.c
i5500_temp.c
ibmaem.c
ibmpex.c
ibmpowernv.c
iio_hwmon.c
ina2xx.c
ina209.c
ina238.c
ina3221.c
intel-m10-bmc-hwmon.c
it87.c
jc42.c
k8temp.c
k10temp.c
Kconfig
lineage-pem.c
lm63.c
lm70.c
lm73.c
lm75.c
lm75.h
lm77.c
lm78.c
lm80.c
lm83.c
lm85.c
lm87.c
lm90.c hwmon: (lm90) Fix sysfs and udev notifications 2022-01-23 18:21:27 -08:00
lm92.c
lm93.c
lm95234.c
lm95241.c
lm95245.c
lochnagar-hwmon.c
ltc2945.c
ltc2947-core.c
ltc2947-i2c.c
ltc2947-spi.c
ltc2947.h
ltc2990.c
ltc2992.c
ltc4151.c
ltc4215.c
ltc4222.c
ltc4245.c
ltc4260.c
ltc4261.c
ltq-cputemp.c
Makefile
max127.c
max197.c
max1111.c
max1619.c
max1668.c
max6620.c
max6621.c
max6639.c
max6642.c
max6650.c
max6697.c
max16065.c
max31722.c
max31730.c
max31790.c
mc13783-adc.c
mcp3021.c
menf21bmc_hwmon.c
mlxreg-fan.c
mr75203.c
nct6683.c
nct6775.c hwmon: (nct6775) Fix crash in clear_caseopen 2022-01-24 14:32:47 -08:00
nct7802.c
nct7904.c
npcm750-pwm-fan.c
nsa320-hwmon.c
ntc_thermistor.c
nzxt-kraken2.c
nzxt-smart2.c
pc87360.c
pc87427.c
pcf8591.c
powr1220.c
pwm-fan.c
raspberrypi-hwmon.c
s3c-hwmon.c
sbrmi.c
sbtsi_temp.c
sch56xx-common.c
sch56xx-common.h
sch5627.c
sch5636.c
scmi-hwmon.c
scpi-hwmon.c
sht3x.c
sht4x.c
sht15.c
sht21.c
shtc1.c
sis5595.c
sl28cpld-hwmon.c
smm665.c
smsc47b397.c
smsc47m1.c
smsc47m192.c
sparx5-temp.c
stts751.c
tc74.c
tc654.c
thmc50.c
tmp102.c
tmp103.c
tmp108.c
tmp401.c
tmp421.c
tmp513.c
tps23861.c
ultra45_env.c
vexpress-hwmon.c
via-cputemp.c
via686a.c
vt1211.c
vt8231.c
w83l785ts.c
w83l786ng.c
w83627ehf.c
w83627hf.c
w83773g.c
w83781d.c
w83791d.c
w83792d.c
w83793.c
w83795.c
wm831x-hwmon.c
wm8350-hwmon.c
xgene-hwmon.c