linux-stable/drivers
Jarkko Nikula 301c8f5c32 i2c: designware: Fix handling of real but unexpected device interrupts
Commit c7b79a7528 ("mfd: intel-lpss: Add Intel Alder Lake PCH-S PCI
IDs") caused a regression on certain Gigabyte motherboards for Intel
Alder Lake-S where system crashes to NULL pointer dereference in
i2c_dw_xfer_msg() when system resumes from S3 sleep state ("deep").

I was able to debug the issue on Gigabyte Z690 AORUS ELITE and made
following notes:

- Issue happens when resuming from S3 but not when resuming from
  "s2idle"
- PCI device 00:15.0 == i2c_designware.0 is already in D0 state when
  system enters into pci_pm_resume_noirq() while all other i2c_designware
  PCI devices are in D3. Devices were runtime suspended and in D3 prior
  entering into suspend
- Interrupt comes after pci_pm_resume_noirq() when device interrupts are
  re-enabled
- According to register dump the interrupt really comes from the
  i2c_designware.0. Controller is enabled, I2C target address register
  points to a one detectable I2C device address 0x60 and the
  DW_IC_RAW_INTR_STAT register START_DET, STOP_DET, ACTIVITY and
  TX_EMPTY bits are set indicating completed I2C transaction.

My guess is that the firmware uses this controller to communicate with
an on-board I2C device during resume but does not disable the controller
before giving control to an operating system.

I was told the UEFI update fixes this but never the less it revealed the
driver is not ready to handle TX_EMPTY (or RX_FULL) interrupt when device
is supposed to be idle and state variables are not set (especially the
dev->msgs pointer which may point to NULL or stale old data).

Introduce a new software status flag STATUS_ACTIVE indicating when the
controller is active in driver point of view. Now treat all interrupts
that occur when is not set as unexpected and mask all interrupts from
the controller.

Fixes: c7b79a7528 ("mfd: intel-lpss: Add Intel Alder Lake PCH-S PCI IDs")
Reported-by: Samuel Clark <slc2015@gmail.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215907
Cc: stable@vger.kernel.org # v5.12+
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2022-10-05 21:00:12 +02:00
..
accessibility
acpi ACPI updates for 6.1-rc1 2022-10-03 13:19:53 -07:00
amba ARM: 9229/1: amba: Fix use-after-free in amba_read_periphid() 2022-08-30 11:12:52 +01:00
android Char/Misc driver fixes for 6.0-rc4 2022-09-02 10:50:08 -07:00
ata Thermal control updates for 6.1-rc1 2022-10-03 15:33:38 -07:00
atm
auxdisplay
base regmap: Updates for v6.1 2022-10-04 19:12:16 -07:00
bcma bcma: Fix typo in comments 2022-09-07 11:00:30 +03:00
block Networking changes for 6.1. 2022-10-04 13:38:03 -07:00
bluetooth Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure 2022-09-19 10:33:39 -07:00
bus bus: mhi: host: pci_generic: Add a secondary AT port to Telit FN990 2022-09-20 16:07:12 -07:00
cdrom
char Merge tag 'v6.0-rc5' into i2c/for-mergewindow 2022-09-16 20:42:18 +01:00
clk * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
clocksource
comedi
connector
counter counter: 104-quad-8: Fix skipped IRQ lines during events configuration 2022-09-22 14:26:37 +02:00
cpufreq Power management updates for 6.1-rc1 2022-10-03 13:26:47 -07:00
cpuidle cpuidle: Remove redundant check in cpuidle_switch_governor() 2022-09-03 20:14:51 +02:00
crypto * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
cxl
dax devdax: Fix soft-reservation memory description 2022-09-24 18:05:53 -07:00
dca
devfreq PM / devfreq: rockchip-dfi: Fix an error message 2022-09-26 03:59:43 +09:00
dio
dma dmaengine: zynqmp_dma: Typecast with enum to fix the coverity warning 2022-09-05 11:54:50 +05:30
dma-buf dma-buf/dma-resv: check if the new fence is really later 2022-08-25 13:10:30 +02:00
edac Merge branches 'edac-drivers' and 'edac-misc' into edac-updates-for-v6.1 2022-10-04 10:00:25 +02:00
eisa
extcon
firewire
firmware Networking changes for 6.1. 2022-10-04 13:38:03 -07:00
fpga fpga: m10bmc-sec: Fix possible memory leak of flash_buf 2022-09-19 12:58:19 +08:00
fsi
gnss
gpio * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
gpu * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
greybus
hid Merge tag 'v6.0-rc5' into i2c/for-mergewindow 2022-09-16 20:42:18 +01:00
hsi
hte
hv Merge branch 'acpi-dev' 2022-09-30 20:05:16 +02:00
hwmon hwmon updates for v6.1 2022-10-04 19:02:54 -07:00
hwspinlock
hwtracing
i2c i2c: designware: Fix handling of real but unexpected device interrupts 2022-10-05 21:00:12 +02:00
i3c
idle intel_idle: Add AlderLake-N support 2022-09-21 20:33:49 +02:00
iio * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
infiniband Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux 2022-09-28 19:20:49 -07:00
input * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
interconnect
iommu iommu/vt-d: Check correct capability for sagaw determination 2022-09-21 10:22:54 +02:00
ipack
irqchip irqchip/loongson-pch-lpc: Add dependence on LoongArch 2022-09-16 09:25:51 +01:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-10-03 17:44:18 -07:00
leds
macintosh macintosh/ams: Adapt declaration of ams_i2c_remove() to earlier change 2022-09-17 20:37:23 +02:00
mailbox
mcb
md dlm for 6.1 2022-10-03 20:11:59 -07:00
media * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
memory
memstick
message
mfd * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
misc * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
mmc mmc: hsq: Fix data stomping during mmc recovery 2022-09-27 12:38:29 +02:00
most
mtd
mux
net * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
nfc Merge tag 'v6.0-rc5' into i2c/for-mergewindow 2022-09-16 20:42:18 +01:00
ntb
nubus
nvdimm Merge branch 'for-6.0/dax' into libnvdimm-fixes 2022-09-24 18:14:12 -07:00
nvme block-6.0-2022-09-29 2022-09-30 09:33:33 -07:00
nvmem
of * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
opp
parisc parisc: remove obsolete manual allocation aligning in iosapic 2022-09-15 07:33:26 +02:00
parport
pci
pcmcia
peci
perf ACPI updates for 6.1-rc1 2022-10-03 13:19:53 -07:00
phy Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-09-29 14:30:51 -07:00
pinctrl Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-09-22 13:02:10 -07:00
platform * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
pnp PNPBIOS: remove unused pnpid32_to_pnpid() declaration 2022-09-24 18:07:42 +02:00
power
powercap powercap: intel_rapl: Use standard Energy Unit for SPR Dram RAPL domain 2022-09-24 19:32:46 +02:00
pps
ps3
ptp ptp: Remove usage of the deprecated ida_simple_xxx API 2022-09-27 17:33:11 -07:00
pwm hwmon updates for v6.1 2022-10-04 19:02:54 -07:00
rapidio
ras RAS/CEC: Reduce offline page threshold for Intel systems 2022-08-22 19:30:02 +02:00
regulator regulator: Updates for v6.1 2022-10-04 19:27:45 -07:00
remoteproc
reset reset: npcm: fix iprst2 and iprst4 setting 2022-09-22 17:48:35 +02:00
rpmsg
rtc
s390 Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-09-29 14:30:51 -07:00
sbus
scsi ATA fixes for 6.0-rc7 2022-09-29 05:40:59 -07:00
sh
siox
slimbus
soc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-09-29 14:30:51 -07:00
soundwire soundwire: qcom: fix device status array range 2022-09-01 14:26:44 +05:30
spi spi: Updates for v6.1 2022-10-04 19:36:53 -07:00
spmi
ssb
staging * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
target genetlink: start to validate reserved header bytes 2022-08-29 12:47:15 +01:00
tc
tee tee: fix compiler warning in tee_shm_register() 2022-08-25 11:40:06 +02:00
thermal Networking changes for 6.1. 2022-10-04 13:38:03 -07:00
thunderbolt Networking changes for 6.1. 2022-10-04 13:38:03 -07:00
tty Merge branch 'master' into i2c/for-mergewindow 2022-09-27 21:33:37 +02:00
ufs
uio
usb * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
vdpa Networking changes for 6.1. 2022-10-04 13:38:03 -07:00
vfio VFIO fix for v6.0-rc5 2022-09-09 07:44:33 -04:00
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-10-03 17:44:18 -07:00
video Merge branch 'master' into i2c/for-mergewindow 2022-09-27 21:33:37 +02:00
virt kunit: fix Kconfig for build-in tests USB4 and Nitro Enclaves 2022-09-01 13:00:48 -06:00
virtio
vlynq
w1
watchdog
xen xen: branch for v6.0-rc7 2022-09-23 08:31:24 -07:00
zorro
Kconfig
Makefile