android_kernel_samsung_a7y1.../drivers
Wei Wang 9336c76f28 thermal: Fix deadlock in thermal thermal_zone_device_check
commit 163b00cde7cf2206e248789d2780121ad5e6a70b upstream.

1851799e1d29 ("thermal: Fix use-after-free when unregistering thermal zone
device") changed cancel_delayed_work to cancel_delayed_work_sync to avoid
a use-after-free issue. However, cancel_delayed_work_sync could be called
insides the WQ causing deadlock.

[54109.642398] c0   1162 kworker/u17:1   D    0 11030      2 0x00000000
[54109.642437] c0   1162 Workqueue: thermal_passive_wq thermal_zone_device_check
[54109.642447] c0   1162 Call trace:
[54109.642456] c0   1162  __switch_to+0x138/0x158
[54109.642467] c0   1162  __schedule+0xba4/0x1434
[54109.642480] c0   1162  schedule_timeout+0xa0/0xb28
[54109.642492] c0   1162  wait_for_common+0x138/0x2e8
[54109.642511] c0   1162  flush_work+0x348/0x40c
[54109.642522] c0   1162  __cancel_work_timer+0x180/0x218
[54109.642544] c0   1162  handle_thermal_trip+0x2c4/0x5a4
[54109.642553] c0   1162  thermal_zone_device_update+0x1b4/0x25c
[54109.642563] c0   1162  thermal_zone_device_check+0x18/0x24
[54109.642574] c0   1162  process_one_work+0x3cc/0x69c
[54109.642583] c0   1162  worker_thread+0x49c/0x7c0
[54109.642593] c0   1162  kthread+0x17c/0x1b0
[54109.642602] c0   1162  ret_from_fork+0x10/0x18
[54109.643051] c0   1162 kworker/u17:2   D    0 16245      2 0x00000000
[54109.643067] c0   1162 Workqueue: thermal_passive_wq thermal_zone_device_check
[54109.643077] c0   1162 Call trace:
[54109.643085] c0   1162  __switch_to+0x138/0x158
[54109.643095] c0   1162  __schedule+0xba4/0x1434
[54109.643104] c0   1162  schedule_timeout+0xa0/0xb28
[54109.643114] c0   1162  wait_for_common+0x138/0x2e8
[54109.643122] c0   1162  flush_work+0x348/0x40c
[54109.643131] c0   1162  __cancel_work_timer+0x180/0x218
[54109.643141] c0   1162  handle_thermal_trip+0x2c4/0x5a4
[54109.643150] c0   1162  thermal_zone_device_update+0x1b4/0x25c
[54109.643159] c0   1162  thermal_zone_device_check+0x18/0x24
[54109.643167] c0   1162  process_one_work+0x3cc/0x69c
[54109.643177] c0   1162  worker_thread+0x49c/0x7c0
[54109.643186] c0   1162  kthread+0x17c/0x1b0
[54109.643195] c0   1162  ret_from_fork+0x10/0x18
[54109.644500] c0   1162 cat             D    0  7766      1 0x00000001
[54109.644515] c0   1162 Call trace:
[54109.644524] c0   1162  __switch_to+0x138/0x158
[54109.644536] c0   1162  __schedule+0xba4/0x1434
[54109.644546] c0   1162  schedule_preempt_disabled+0x80/0xb0
[54109.644555] c0   1162  __mutex_lock+0x3a8/0x7f0
[54109.644563] c0   1162  __mutex_lock_slowpath+0x14/0x20
[54109.644575] c0   1162  thermal_zone_get_temp+0x84/0x360
[54109.644586] c0   1162  temp_show+0x30/0x78
[54109.644609] c0   1162  dev_attr_show+0x5c/0xf0
[54109.644628] c0   1162  sysfs_kf_seq_show+0xcc/0x1a4
[54109.644636] c0   1162  kernfs_seq_show+0x48/0x88
[54109.644656] c0   1162  seq_read+0x1f4/0x73c
[54109.644664] c0   1162  kernfs_fop_read+0x84/0x318
[54109.644683] c0   1162  __vfs_read+0x50/0x1bc
[54109.644692] c0   1162  vfs_read+0xa4/0x140
[54109.644701] c0   1162  SyS_read+0xbc/0x144
[54109.644708] c0   1162  el0_svc_naked+0x34/0x38
[54109.845800] c0   1162 D 720.000s 1->7766->7766 cat [panic]

Fixes: 1851799e1d29 ("thermal: Fix use-after-free when unregistering thermal zone device")
Cc: stable@vger.kernel.org
Signed-off-by: Wei Wang <wvw@google.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-07 12:46:09 +02:00
..
accessibility
acpi ACPI / APEI: Switch estatus pool to use vmalloc memory 2020-04-07 12:43:08 +02:00
amba
android
ata ata: ep93xx: Use proper enums for directions 2020-04-07 12:32:33 +02:00
atm atm: zatm: Fix empty body Clang warnings 2020-04-07 12:35:08 +02:00
auxdisplay
base
battery
battery_v2
bcma
block rsxx: add missed destroy_workqueue calls in remove 2020-04-07 12:44:10 +02:00
bluetooth Bluetooth: Fix invalid-free in bcsp_close() 2020-04-07 12:36:50 +02:00
bts
bus
ccic
cdrom
char hwrng: stm32 - fix unbalanced pm_runtime_enable 2020-04-07 12:43:44 +02:00
clk clk: rockchip: fix rk3188 sclk_mac_lbtest parameter ordering 2020-04-07 12:44:23 +02:00
clocksource
connector
cpufreq cpufreq: Add NULL checks to show() and store() methods of cpufreq 2020-04-07 12:37:15 +02:00
cpuidle
crypto crypto: crypto4xx - fix double-free in crypto4xx_destroy_sdr 2020-04-07 12:46:01 +02:00
dca
devfreq
dio
dma dmaengine: coh901318: Remove unused variable 2020-04-07 12:44:51 +02:00
dma-buf
edac
eisa
extcon extcon: max8997: Fix lack of path setting in USB device mode 2020-04-07 12:44:20 +02:00
fingerprint
firewire
firmware gsmi: Fix bug in append_to_eventlog sysfs handler 2020-04-07 12:34:33 +02:00
five
fmc
fpga
gator
gpio gpio: syscon: Fix possible NULL ptr usage 2020-04-07 12:33:18 +02:00
gps
gpu drm/i810: Prevent underflow in ioctl 2020-04-07 12:45:55 +02:00
gud
hid HID: core: check whether Usage Page item is after Usage ID items 2020-04-07 12:43:42 +02:00
hsi
hv
hwmon hwmon: (pwm-fan) Silence error on probe deferral 2020-04-07 12:33:24 +02:00
hwspinlock
hwtracing
i2c i2c: imx: don't print error message on probe defer 2020-04-07 12:45:01 +02:00
ide
idle
iio
infiniband RDMA/qib: Validate ->show()/store() callbacks before calling them 2020-04-07 12:46:07 +02:00
input Input: goodix - add upside-down quirk for Teclast X89 tablet 2020-04-07 12:45:43 +02:00
iommu
ipack
irqchip
isdn mISDN: Fix type of switch control variable in ctrl_teimanager 2020-04-07 12:35:21 +02:00
leds
lguest
lightnvm
macintosh macintosh/windfarm_smu_sat: Fix debug output 2020-04-07 12:35:02 +02:00
mailbox
mcb
md dm: use blk_set_queue_dying() in __dm_destroy() 2020-04-07 12:36:54 +02:00
media media: v4l2-ctrl: fix flags for DO_WHITE_BALANCE 2020-04-07 12:43:22 +02:00
memory
memstick
message
mfd mfd: max8997: Enale irq-wakeup unconditionally 2020-04-07 12:35:27 +02:00
misc altera-stapl: check for a null key before strcasecmp'ing it 2020-04-07 12:44:57 +02:00
mmc mmc: block: Fix tag condition with packed writes 2020-04-07 12:37:02 +02:00
motor
mtd mtd: Remove a debug trace in mtdpart.c 2020-04-07 12:43:14 +02:00
muic
net can: slcan: Fix use-after-free Read in slcan_open 2020-04-07 12:45:51 +02:00
nfc NFC: nxp-nci: Fix NULL pointer dereference after I2C communication error 2020-04-07 12:44:04 +02:00
ntb ntb: intel: fix return value for ndev_vec_mask() 2020-04-07 12:36:03 +02:00
nubus
nvdimm
nvme
nvmem
of
oprofile
parisc
parport
pci PCI: keystone: Use quirk to limit MRRS for K2G 2020-04-07 12:36:44 +02:00
pcmcia
perf
phy
pinctrl pinctrl: qcom: ssbi-gpio: fix gpio-hog related boot issues 2020-04-07 12:44:31 +02:00
platform platform/x86: hp-wmi: Fix ACPI errors caused by too small buffer 2020-04-07 12:43:46 +02:00
pnp
power PM / AVS: SmartReflex: NULL check before some freeing functions is not needed 2020-04-07 12:41:14 +02:00
powercap
pps
ps3
ptp
pwm pwm: Clear chip_data in pwm_put() 2020-04-07 12:43:26 +02:00
rapidio
ras
regulator regulator: tps65910: fix a missing check of return value 2020-04-07 12:42:28 +02:00
remoteproc
reset
rpmsg
rtc rtc: max8997: Fix the returned value in case of error in 'max8997_rtc_read_alarm()' 2020-04-07 12:44:43 +02:00
s390 scsi: zfcp: drop default switch case which might paper over missing case 2020-04-07 12:44:29 +02:00
sbus
scsi scsi: libsas: Check SMP PHY control function result 2020-04-07 12:43:10 +02:00
security/samsung/icdrv
sensorhub
sensors
sfi
sh
sn
soc
spi spi: atmel: Fix CS high support 2020-04-07 12:46:05 +02:00
spmi
ssb
staging Staging: iio: adt7316: Fix i2c data reading, set the data field 2020-04-07 12:44:35 +02:00
switch
target
tc
tee
thermal thermal: Fix deadlock in thermal thermal_zone_device_check 2020-04-07 12:46:09 +02:00
thunderbolt
trace
tty tty: vt: keyboard: reject invalid keycodes 2020-04-07 12:45:49 +02:00
uh
uio
usb usb: gadget: u_serial: add missing port entry locking 2020-04-07 12:43:52 +02:00
uwb
vfio vfio/pci: Fix potential memory leak in vfio_msi_cap_len 2020-04-07 12:29:30 +02:00
vhost
video backlight: lm3639: Unconditionally call led_classdev_unregister 2020-04-07 12:33:07 +02:00
virt
virtio
vision
vlynq
vme
w1
watchdog
xen xen/pciback: Check dev_data before using it 2020-04-07 12:41:44 +02:00
zorro
Kconfig
Makefile