OpenCloudOS-Kernel/drivers/i2c/busses
Dhananjay Phadke bba676cc0b i2c: iproc: fix race between client unreg and tasklet
Similar NULL deref was originally fixed by graceful teardown sequence -

https://lore.kernel.org/linux-i2c/1597106560-79693-1-git-send-email-dphadke@linux.microsoft.com

After this, a tasklet was added to take care of FIFO full condition for large i2c
transaction.

https://lore.kernel.org/linux-arm-kernel/20201102035433.6774-1-rayagonda.kokatanur@broadcom.com/

This introduced regression, a new race condition between tasklet enabling
interrupts and client unreg teardown sequence.

Kill tasklet before unreg_slave() masks bits in IE_OFFSET.
Updated teardown sequence -
(1) disable_irq()
(2) Kill tasklet
(3) Mask event enable bits in control reg
(4) Erase slave address (avoid further writes to rx fifo)
(5) Flush tx and rx FIFOs
(6) Clear pending event (interrupt) bits in status reg
(7) Set client pointer to NULL
(8) enable_irq()

 --

 Unable to handle kernel read from unreadable memory at virtual address 0000000000000320
 Mem abort info:
   ESR = 0x96000004
   EC = 0x25: DABT (current EL), IL = 32 bits
   SET = 0, FnV = 0
   EA = 0, S1PTW = 0
 Data abort info:
   ISV = 0, ISS = 0x00000004
   CM = 0, WnR = 0
 user pgtable: 4k pages, 48-bit VAs, pgdp=000000009212a000
 [0000000000000320] pgd=0000000000000000, p4d=0000000000000000
 Internal error: Oops: 96000004 [#1] SMP
 CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           O
 Hardware name: Overlake (DT)
 pstate: 40400085 (nZcv daIf +PAN -UAO -TCO BTYPE=--)
 pc : bcm_iproc_i2c_slave_isr+0x2b8/0x8e4
 lr : bcm_iproc_i2c_slave_isr+0x1c8/0x8e4
 sp : ffff800010003e70
 x29: ffff800010003e80 x28: ffffda017acdc000
 x27: ffffda017b0ae000 x26: ffff800010004000
 x25: ffff800010000000 x24: ffffda017af4a168
 x23: 0000000000000073 x22: 0000000000000000
 x21: 0000000001400000 x20: 0000000001000000
 x19: ffff06f09583f880 x18: 00000000fa83b2da
 x17: 000000000000b67e x16: 0000000002edb2f3
 x15: 00000000000002c7 x14: 00000000000002c7
 x13: 0000000000000006 x12: 0000000000000033
 x11: 0000000000000000 x10: 0000000001000000
 x9 : 0000000003289312 x8 : 0000000003289311
 x7 : 02d0cd03a303adbc x6 : 02d18e7f0a4dfc6c
 x5 : 02edb2f33f76ea68 x4 : 00000000fa83b2da
 x3 : ffffda017af43cd0 x2 : ffff800010003e74
 x1 : 0000000001400000 x0 : 0000000000000000
 Call trace:
  bcm_iproc_i2c_slave_isr+0x2b8/0x8e4
  bcm_iproc_i2c_isr+0x178/0x290
  __handle_irq_event_percpu+0xd0/0x200
  handle_irq_event+0x60/0x1a0
  handle_fasteoi_irq+0x130/0x220
  __handle_domain_irq+0x8c/0xcc
  gic_handle_irq+0xc0/0x120
  el1_irq+0xcc/0x180
  finish_task_switch+0x100/0x1d8
  __schedule+0x61c/0x7a0
  schedule_idle+0x28/0x44
  do_idle+0x254/0x28c
  cpu_startup_entry+0x28/0x2c
  rest_init+0xc4/0xd0
  arch_call_rest_init+0x14/0x1c
  start_kernel+0x33c/0x3b8
 Code: f9423260 910013e2 11000509 b9047a69 (f9419009)
 ---[ end trace 4781455b2a7bec15 ]---

Fixes: 4d658451c9 ("i2c: iproc: handle rx fifo full interrupt")

Signed-off-by: Dhananjay Phadke <dphadke@linux.microsoft.com>
Acked-by: Ray Jui <ray.jui@broadcom.com>
Acked-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2021-08-10 22:40:55 +02:00
..
Kconfig i2c: I2C_HISI should depend on ACPI 2021-05-25 21:24:50 +02:00
Makefile i2c: add support for HiSilicon I2C controller 2021-04-10 21:54:05 +02:00
i2c-acorn.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
i2c-ali15x3.c i2c: Use separate MODULE_AUTHOR() statements for multiple authors 2020-07-04 08:25:13 +02:00
i2c-ali1535.c i2c: ali1535: mention that the device should not be disabled 2021-07-02 09:14:46 +02:00
i2c-ali1563.c i2c: busses: i2c-ali1563: File headers are not good candidates for kernel-doc 2021-05-27 21:29:26 +02:00
i2c-altera.c i2c: altera: Fix formatting issue in struct and demote unworthy kernel-doc headers 2021-06-03 22:25:24 +02:00
i2c-amd-mp2-pci.c i2c: amd-mp2: convert to PCI logging functions 2021-02-01 23:01:29 +01:00
i2c-amd-mp2-plat.c i2c: amd-mp2: convert to PCI logging functions 2021-02-01 23:01:29 +01:00
i2c-amd-mp2.h i2c: amd-mp2: Remove unused macro 2021-02-01 23:01:50 +01:00
i2c-amd756-s4882.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-amd756.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-amd8111.c i2c: amd8111: Fix coding style issues 2021-04-15 22:24:11 +02:00
i2c-aspeed.c i2c: aspeed: disable additional device addresses on ast2[56]xx 2021-05-27 21:44:19 +02:00
i2c-at91-core.c i2c: at91: Send bus clear command if SDA is down 2020-05-05 16:37:21 +02:00
i2c-at91-master.c i2c: at91: remove legacy DMA left overs 2020-11-03 21:34:40 +01:00
i2c-at91-slave.c i2c: at91: added slave mode support 2019-03-24 22:41:51 +01:00
i2c-at91.h i2c: at91: remove legacy DMA left overs 2020-11-03 21:34:40 +01:00
i2c-au1550.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-axxia.c i2c: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-bcm-iproc.c i2c: iproc: fix race between client unreg and tasklet 2021-08-10 22:40:55 +02:00
i2c-bcm-kona.c i2c: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-bcm2835.c i2c: bcm2835: Simplify with dev_err_probe() 2020-09-18 23:02:03 +02:00
i2c-brcmstb.c i2c: remove unused 'version.h' include in drivers 2021-04-08 23:12:38 +02:00
i2c-cadence.c Merge branch 'i2c/for-mergewindow' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2021-07-04 11:47:18 -07:00
i2c-cbus-gpio.c i2c: cbus-gpio: Switch to use GPIO descriptors 2019-02-08 22:18:51 +01:00
i2c-cht-wc.c i2c: cht-wc: Replace of_node by NULL 2021-06-20 22:47:24 +02:00
i2c-cp2615.c i2c: cp2615: check for allocation failure in cp2615_i2c_recv() 2021-06-20 23:13:34 +02:00
i2c-cpm.c i2c: cpm: Fix i2c_ram structure 2020-09-27 15:14:16 +02:00
i2c-cros-ec-tunnel.c i2c: cros-ec-tunnel: Fix ACPI identifier 2020-01-31 09:01:25 +01:00
i2c-davinci.c i2c: davinci: Simplify with dev_err_probe() 2021-06-23 18:23:55 +02:00
i2c-designware-baytrail.c i2c: designware: Fix spelling typos in the comments 2020-03-21 19:53:08 +01:00
i2c-designware-common.c i2c: designware: Add driver support for AMD NAVI GPU 2021-04-05 23:00:46 +02:00
i2c-designware-core.h i2c: designware: Add driver support for AMD NAVI GPU 2021-04-05 23:00:46 +02:00
i2c-designware-master.c i2c: busses: i2c-designware-master: Fix misnaming of 'i2c_dw_init_master()' 2021-05-27 21:32:12 +02:00
i2c-designware-pcidrv.c i2c: designware: Fix return value check in navi_amd_register_client() 2021-04-08 22:47:48 +02:00
i2c-designware-platdrv.c i2c: designware: Get rid of legacy platform data 2021-04-14 16:06:46 +01:00
i2c-designware-slave.c i2c: designware: slave should do WRITE_REQUESTED before WRITE_RECEIVED 2020-11-06 16:02:00 +01:00
i2c-digicolor.c i2c: busses: Replace spin_lock_irqsave with spin_lock in hard IRQ 2021-02-12 08:21:57 +01:00
i2c-diolan-u2c.c i2c: drivers: Use generic definitions for bus frequencies 2020-03-24 22:36:59 +01:00
i2c-dln2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
i2c-eg20t.c i2c: busses: i2c-eg20t: Fix 'bad line' issue and provide description for 'msgs' param 2021-05-27 21:33:10 +02:00
i2c-elektor.c Merge branch 'i2c/for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2021-02-22 09:02:24 -08:00
i2c-emev2.c i2c: emev2: add IRQ check 2021-04-14 10:20:00 +02:00
i2c-exynos5.c i2c: exynos5: correct top kerneldoc 2021-04-06 22:32:33 +02:00
i2c-fsi.c i2c: fsi: Prevent adding adapters for ports without dts nodes 2020-07-24 21:31:33 +02:00
i2c-gpio.c i2c: gpio: fix MODULE_LICENCE 2021-01-05 17:30:45 +01:00
i2c-highlander.c Merge branch 'i2c/for-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2020-02-07 12:54:13 -08:00
i2c-hisi.c i2c: add support for HiSilicon I2C controller 2021-04-10 21:54:05 +02:00
i2c-hix5hd2.c i2c: hix5hd2: use the correct HiSilicon copyright 2021-03-31 10:06:40 +02:00
i2c-hydra.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-i801.c Merge branch 'i2c/for-mergewindow' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2021-07-04 11:47:18 -07:00
i2c-ibm_iic.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
i2c-ibm_iic.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
i2c-icy.c i2c: icy: Remove unused variable new_fwnode in icy_probe() 2021-05-25 21:21:32 +02:00
i2c-img-scb.c i2c: img-scb: fix reference leak when pm_runtime_get_sync fails 2021-04-14 09:49:06 +02:00
i2c-imx-lpi2c.c i2c: imx-lpi2c: fix reference leak when pm_runtime_get_sync fails 2021-04-14 09:49:09 +02:00
i2c-imx.c i2c: imx: Fix some checkpatch warnings 2021-06-24 21:58:35 +02:00
i2c-iop3xx.c i2c: iop3xx: Fix coding style issues 2021-04-15 22:24:23 +02:00
i2c-iop3xx.h Merge branch 'i2c/for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2019-07-15 21:10:39 -07:00
i2c-isch.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
i2c-ismt.c i2c: ismt: Adding support for I2C_SMBUS_BLOCK_PROC_CALL 2020-12-03 21:20:53 +01:00
i2c-jz4780.c Merge branch 'i2c/for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2021-04-30 13:01:02 -07:00
i2c-kempld.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 294 2019-06-05 17:36:38 +02:00
i2c-lpc2k.c i2c: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-meson.c i2c: meson: fixup rate calculation with filter delay 2020-10-08 11:57:23 +02:00
i2c-mlxbf.c i2c: mlxbf: add IRQ check 2021-04-14 10:20:45 +02:00
i2c-mlxcpld.c i2c: mlxcpld: Add support for I2C bus frequency setting 2021-01-06 15:36:46 +01:00
i2c-mpc.c i2c: mpc: Poll for MCF 2021-07-20 22:32:01 +02:00
i2c-mt65xx.c Merge branch 'i2c/for-mergewindow' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2021-07-04 11:47:18 -07:00
i2c-mt7621.c i2c: drivers: Use generic definitions for bus frequencies 2020-03-24 22:36:59 +01:00
i2c-mv64xxx.c i2c: mv64xxx: Fix random system lock caused by runtime PM 2021-04-15 22:13:19 +02:00
i2c-mxs.c i2c: mxs: Remove unneeded platform_device_id 2020-12-02 21:29:31 +01:00
i2c-nforce2-s4985.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-nforce2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-nomadik.c i2c: busses: i2c-nomadik: Fix formatting issue pertaining to 'timeout' 2021-05-27 21:27:48 +02:00
i2c-npcm7xx.c i2c: npcm7xx: Clear LAST bit after a failed transaction. 2020-09-27 20:05:27 +02:00
i2c-nvidia-gpu.c i2c: nvidia-gpu: Constify the software node 2021-04-10 21:43:01 +02:00
i2c-ocores.c i2c: busses: i2c-ocores: Place the expected function names into the documentation headers 2021-05-27 21:33:41 +02:00
i2c-octeon-core.c i2c: octeon: check correct size of maximum RECV_LEN packet 2021-01-17 12:26:55 +01:00
i2c-octeon-core.h i2c: octeon: Prevent error message on bus error 2018-03-02 11:11:15 +01:00
i2c-octeon-platdrv.c i2c: busses: convert to devm_platform_ioremap_resource 2020-04-15 12:09:09 +02:00
i2c-omap.c i2c: omap: fix reference leak when pm_runtime_get_sync fails 2021-04-14 09:49:17 +02:00
i2c-opal.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
i2c-owl.c i2c: owl: Add compatible for the Actions Semi S500 I2C controller 2020-12-09 21:23:21 +01:00
i2c-parport.c i2c: convert SMBus alert setup function to return an ERRPTR 2020-03-10 12:19:52 +01:00
i2c-pasemi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
i2c-pca-isa.c isa: Make the remove callback for isa drivers return void 2021-01-26 07:42:27 +01:00
i2c-pca-platform.c i2c: pca-platform: drop two members from driver data that are assigned to only 2020-12-02 21:29:31 +01:00
i2c-piix4.c i2c: Use separate MODULE_AUTHOR() statements for multiple authors 2020-07-04 08:25:13 +02:00
i2c-pmcmsp.c Merge branch 'i2c/for-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2020-02-07 12:54:13 -08:00
i2c-pnx.c i2c: busses: i2c-pnx: Provide descriptions for 'alg_data' data structure 2021-05-27 21:34:08 +02:00
i2c-powermac.c i2c: powermac: remove uncertainty about SMBUS_BLOCK transfers 2021-03-18 11:59:57 +01:00
i2c-pxa-pci.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 462 2019-06-19 17:09:10 +02:00
i2c-pxa.c i2c: pxa: move to generic GPIO recovery 2020-12-09 21:45:47 +01:00
i2c-qcom-cci.c i2c: qcom-cci: add sm8250 compatible 2021-05-25 21:14:04 +02:00
i2c-qcom-geni.c i2c: qcom-geni: Suspend and resume the bus during SYSTEM_SLEEP_PM ops 2021-06-04 22:32:58 +02:00
i2c-qup.c i2c: qup: advertise SMBus transfers using RECV_LEN 2021-01-22 09:59:25 +01:00
i2c-rcar.c i2c: rcar: Drop "renesas,i2c-rcar" 2021-05-28 09:50:43 +02:00
i2c-riic.c i2c: riic: Add RZ/G2L support 2021-06-20 22:40:44 +02:00
i2c-rk3x.c i2c: rk3x: Simplify with dev_err_probe() 2020-09-27 19:58:56 +02:00
i2c-robotfuzz-osif.c i2c: robotfuzz-osif: fix control-request directions 2021-06-24 22:08:00 +02:00
i2c-s3c2410.c i2c: s3c2410: fix possible NULL pointer deref on read message after write 2021-05-28 10:16:23 +02:00
i2c-scmi.c i2c: i2c-scmi: Drop unused ACPI_MODULE_NAME definition 2021-03-18 12:11:45 +01:00
i2c-sh7760.c i2c: sh7760: fix IRQ error path 2021-04-17 22:00:58 +02:00
i2c-sh_mobile.c i2c: sh_mobile: Use new clock calculation formulas for RZ/G2E 2021-05-25 21:53:46 +02:00
i2c-sibyte.c i2c: Use separate MODULE_AUTHOR() statements for multiple authors 2020-07-04 08:25:13 +02:00
i2c-simtec.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 235 2019-06-19 17:09:07 +02:00
i2c-sis96x.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-sis630.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-sis5595.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-sprd.c i2c: sprd: fix reference leak when pm_runtime_get_sync fails 2021-04-14 09:49:20 +02:00
i2c-st.c i2c: busses: i2c-st: Fix copy/paste function misnaming issues 2021-05-27 21:39:35 +02:00
i2c-stm32.c i2c: stm32: Simplify with dev_err_probe() 2020-09-21 11:45:43 +02:00
i2c-stm32.h i2c: stm32: Use the correct style for SPDX License Identifier 2019-08-14 14:56:54 +02:00
i2c-stm32f4.c i2c: busses: i2c-stm32f4: Remove incorrectly placed ' ' from function name 2021-05-27 21:39:57 +02:00
i2c-stm32f7.c i2c: stm32f7: add SMBus-Alert support 2021-05-25 21:48:19 +02:00
i2c-sun6i-p2wi.c i2c: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-synquacer.c i2c: busses: Use fallthrough pseudo-keyword 2020-07-23 22:04:08 +02:00
i2c-taos-evm.c i2c: taos-evm: convert to use i2c_new_client_device() 2020-01-15 20:39:41 +01:00
i2c-tegra-bpmp.c i2c: tegra-bpmp: Demote kernel-doc abuses 2021-06-03 22:31:42 +02:00
i2c-tegra.c i2c: tegra: Use threaded interrupt 2021-01-28 10:03:58 +01:00
i2c-thunderx-pcidrv.c i2c: drivers: Use generic definitions for bus frequencies 2020-03-24 22:36:59 +01:00
i2c-tiny-usb.c i2c: tiny-usb: Correct I2C fault codes. 2020-01-06 15:40:43 +01:00
i2c-uniphier-f.c i2c: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-uniphier.c i2c: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-versatile.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
i2c-via.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-viapro.c i2c: busses: Use fallthrough pseudo-keyword 2020-07-23 22:04:08 +02:00
i2c-viperboard.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
i2c-wmt.c i2c: drivers: Use generic definitions for bus frequencies 2020-03-24 22:36:59 +01:00
i2c-xgene-slimpro.c i2c: remove unused 'version.h' include in drivers 2021-04-08 23:12:38 +02:00
i2c-xiic.c i2c: xiic: Simplify with dev_err_probe() 2021-06-23 18:22:17 +02:00
i2c-xlp9xx.c i2c: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-xlr.c i2c: busses: convert to devm_platform_ioremap_resource 2020-04-15 12:09:09 +02:00
scx200_acb.c i2c: busses: Use fallthrough pseudo-keyword 2020-07-23 22:04:08 +02:00