linux/drivers/i2c/busses
Dhananjay Phadke b1eef236f5 i2c: iproc: fix race between client unreg and isr
When i2c client unregisters, synchronize irq before setting
iproc_i2c->slave to NULL.

(1) disable_irq()
(2) Mask event enable bits in control reg
(3) Erase slave address (avoid further writes to rx fifo)
(4) Flush tx and rx FIFOs
(5) Clear pending event (interrupt) bits in status reg
(6) enable_irq()
(7) Set client pointer to NULL

Unable to handle kernel NULL pointer dereference at virtual address 0000000000000318

[  371.020421] pc : bcm_iproc_i2c_isr+0x530/0x11f0
[  371.025098] lr : __handle_irq_event_percpu+0x6c/0x170
[  371.030309] sp : ffff800010003e40
[  371.033727] x29: ffff800010003e40 x28: 0000000000000060
[  371.039206] x27: ffff800010ca9de0 x26: ffff800010f895df
[  371.044686] x25: ffff800010f18888 x24: ffff0008f7ff3600
[  371.050165] x23: 0000000000000003 x22: 0000000001600000
[  371.055645] x21: ffff800010f18888 x20: 0000000001600000
[  371.061124] x19: ffff0008f726f080 x18: 0000000000000000
[  371.066603] x17: 0000000000000000 x16: 0000000000000000
[  371.072082] x15: 0000000000000000 x14: 0000000000000000
[  371.077561] x13: 0000000000000000 x12: 0000000000000001
[  371.083040] x11: 0000000000000000 x10: 0000000000000040
[  371.088519] x9 : ffff800010f317c8 x8 : ffff800010f317c0
[  371.093999] x7 : ffff0008f805b3b0 x6 : 0000000000000000
[  371.099478] x5 : ffff0008f7ff36a4 x4 : ffff8008ee43d000
[  371.104957] x3 : 0000000000000000 x2 : ffff8000107d64c0
[  371.110436] x1 : 00000000c00000af x0 : 0000000000000000

[  371.115916] Call trace:
[  371.118439]  bcm_iproc_i2c_isr+0x530/0x11f0
[  371.122754]  __handle_irq_event_percpu+0x6c/0x170
[  371.127606]  handle_irq_event_percpu+0x34/0x88
[  371.132189]  handle_irq_event+0x40/0x120
[  371.136234]  handle_fasteoi_irq+0xcc/0x1a0
[  371.140459]  generic_handle_irq+0x24/0x38
[  371.144594]  __handle_domain_irq+0x60/0xb8
[  371.148820]  gic_handle_irq+0xc0/0x158
[  371.152687]  el1_irq+0xb8/0x140
[  371.155927]  arch_cpu_idle+0x10/0x18
[  371.159615]  do_idle+0x204/0x290
[  371.162943]  cpu_startup_entry+0x24/0x60
[  371.166990]  rest_init+0xb0/0xbc
[  371.170322]  arch_call_rest_init+0xc/0x14
[  371.174458]  start_kernel+0x404/0x430

Fixes: c245d94ed1 ("i2c: iproc: Add multi byte read-write support for slave mode")

Signed-off-by: Dhananjay Phadke <dphadke@linux.microsoft.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Ray Jui <ray.jui@broadcom.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2020-08-12 22:03:58 +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: Use separate MODULE_AUTHOR() statements for multiple authors 2020-07-04 08:25:13 +02:00
i2c-ali1563.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 428 2019-06-05 17:37:16 +02:00
i2c-altera.c i2c: altera: cleanup spinlock 2020-05-20 15:28:03 +02: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: busses: Use fallthrough pseudo-keyword 2020-07-23 22:04:08 +02:00
i2c-amd-mp2-pci.c i2c: amd-mp2-pci: Fix Oops in amd_mp2_pci_init() error handling 2020-04-30 16:11:41 +02:00
i2c-amd-mp2-plat.c i2c: drivers: Use generic definitions for bus frequencies 2020-03-24 22:36:59 +01:00
i2c-amd-mp2.h i2c: Add drivers for the AMD PCIe MP2 I2C controller 2019-03-25 15:21:17 +01:00
i2c-aspeed.c i2c: busses: Use fallthrough pseudo-keyword 2020-07-23 22:04:08 +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: Move to generic GPIO bus recovery 2020-08-05 11:52:27 +02:00
i2c-at91-slave.c i2c: at91: added slave mode support 2019-03-24 22:41:51 +01:00
i2c-at91.h i2c: at91: Move to generic GPIO bus recovery 2020-08-05 11:52:27 +02: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-bcm2835.c i2c: bcm2835: Replace HTTP links with HTTPS ones 2020-08-05 11:52:28 +02:00
i2c-bcm-iproc.c i2c: iproc: fix race between client unreg and isr 2020-08-12 22:03:58 +02:00
i2c-bcm-kona.c i2c: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-brcmstb.c i2c: brcmstb: Fix handling of optional interrupt 2020-04-26 10:00:29 +02:00
i2c-cadence.c i2c: cadence: Clear HOLD bit at correct time in Rx path 2020-07-22 12:28:07 +02: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: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-cpm.c 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-cros-ec-tunnel.c i2c: cros-ec-tunnel: Fix ACPI identifier 2020-01-31 09:01:25 +01:00
i2c-davinci.c i2c: busses: convert to devm_platform_ioremap_resource 2020-04-15 12:09:09 +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: Adjust bus speed independently of ACPI 2020-06-23 21:24:33 +02:00
i2c-designware-core.h i2c: designware: Adjust bus speed independently of ACPI 2020-06-23 21:24:33 +02:00
i2c-designware-master.c i2c: designware: Convert driver to using regmap API 2020-05-30 23:02:22 +02:00
i2c-designware-pcidrv.c i2c: busses: Use fallthrough pseudo-keyword 2020-07-23 22:04:08 +02:00
i2c-designware-platdrv.c i2c: designware: platdrv: Set class based on DMI 2020-07-04 08:17:53 +02:00
i2c-designware-slave.c i2c: designware: Convert driver to using regmap API 2020-05-30 23:02:22 +02:00
i2c-digicolor.c i2c: busses: Use fallthrough pseudo-keyword 2020-07-23 22:04:08 +02: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-efm32.c i2c: efm32: Avoid unnecessary check in efm32_i2c_probe() 2020-05-22 17:08:19 +02:00
i2c-eg20t.c i2c: eg20t: use generic power management 2020-08-10 15:47:38 +02:00
i2c-elektor.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-emev2.c i2c: Use separate MODULE_AUTHOR() statements for multiple authors 2020-07-04 08:25:13 +02:00
i2c-exynos5.c i2c: Drop stray comma in MODULE_AUTHOR statements 2020-06-11 12:32:14 +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: suppress error on probe defer 2020-03-10 12:31:55 +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-hix5hd2.c i2c: busses: convert to devm_platform_ioremap_resource 2020-04-15 12:09:09 +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 i2c: i801: Add support for Intel Tiger Lake PCH-H 2020-08-05 11:52:29 +02: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: Fix build with CONFIG_AMIGA_PCMCIA=n 2020-06-07 20:45:24 +02:00
i2c-img-scb.c i2c: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-imx-lpi2c.c i2c: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-imx.c i2c: drivers: Use generic definitions for bus frequencies 2020-03-24 22:36:59 +01:00
i2c-iop3xx.c i2c: iop3xx: Fix memory leak in probe error path 2020-01-15 20:31:27 +01: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: Remove call to memset after dmam_alloc_coherent 2019-08-01 14:48:55 +02:00
i2c-jz4780.c i2c: busses: convert to devm_platform_ioremap_resource 2020-04-15 12:09:09 +02: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: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-mlxcpld.c i2c: mlxcpld: check correct size of maximum RECV_LEN packet 2020-07-04 08:20:38 +02:00
i2c-mpc.c
i2c-mt65xx.c i2c: mediatek: Fix i2c_spec_values description 2020-08-10 11:39:35 +02:00
i2c-mt7621.c i2c: drivers: Use generic definitions for bus frequencies 2020-03-24 22:36:59 +01:00
i2c-mv64xxx.c i2c: busses: Use fallthrough pseudo-keyword 2020-07-23 22:04:08 +02:00
i2c-mxs.c i2c: drivers: Use generic definitions for bus frequencies 2020-03-24 22:36:59 +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: Use separate MODULE_AUTHOR() statements for multiple authors 2020-07-04 08:25:13 +02:00
i2c-npcm7xx.c i2c: npcm7xx: npcm_i2caddr[] can be static 2020-06-11 12:30:47 +02:00
i2c-nvidia-gpu.c i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code 2020-05-27 12:07:34 +02:00
i2c-ocores.c i2c: ocores: convert to use i2c_new_client_device() 2020-01-15 20:39:26 +01:00
i2c-octeon-core.c
i2c-octeon-core.h
i2c-octeon-platdrv.c i2c: busses: convert to devm_platform_ioremap_resource 2020-04-15 12:09:09 +02:00
i2c-omap.c i2c: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-opal.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 114 2019-05-24 17:39:01 +02:00
i2c-owl.c i2c: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02: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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-pca-platform.c i2c: busses: convert to devm_platform_get_and_ioremap_resource 2020-04-15 12:12:52 +02: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: Use separate MODULE_AUTHOR() statements for multiple authors 2020-07-04 08:25:13 +02:00
i2c-powermac.c i2c: powermac: use true,false for bool variable 2020-04-30 16:18:30 +02:00
i2c-puv3.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02: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: don't error out if there's no pinctrl 2020-06-03 22:37:37 +02:00
i2c-qcom-cci.c i2c: Add Qualcomm CCI I2C driver 2020-04-18 23:38:20 +02:00
i2c-qcom-geni.c i2c: i2c-qcom-geni: Fix DMA transfer race 2020-07-23 22:26:44 +02:00
i2c-qup.c i2c: qup: remove unneeded conversion to bool 2020-04-26 10:15:37 +02:00
i2c-rcar.c i2c: rcar: avoid race when unregistering slave 2020-07-31 15:56:32 +02:00
i2c-riic.c i2c: drivers: Use generic definitions for bus frequencies 2020-03-24 22:36:59 +01:00
i2c-rk3x.c i2c: rk3x: support master_xfer_atomic 2020-07-04 08:44:39 +02:00
i2c-robotfuzz-osif.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
i2c-s3c2410.c Merge branch 'i2c/for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2020-06-13 13:12:38 -07:00
i2c-scmi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
i2c-sh7760.c
i2c-sh_mobile.c i2c: Use separate MODULE_AUTHOR() statements for multiple authors 2020-07-04 08:25:13 +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-sirf.c i2c: Use separate MODULE_AUTHOR() statements for multiple authors 2020-07-04 08:25:13 +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: busses: remove duplicate dev_err() 2020-04-18 23:42:14 +02:00
i2c-st.c Merge branch 'i2c/for-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2020-04-02 15:54:13 -07:00
i2c-stm32.c i2c: stm32: don't print an error on probe deferral 2020-04-26 09:46:39 +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: stm32: don't print an error on probe deferral 2020-04-26 09:46:39 +02:00
i2c-stm32f7.c i2c: stm32f7: prevent array underflow in stm32f7_get_lower_rate() 2020-04-30 16:07:14 +02:00
i2c-stu300.c i2c: busses: convert to devm_platform_ioremap_resource 2020-04-15 12:09:09 +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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
i2c-tegra.c i2c: tegra: Avoid tegra_i2c_init_dma() for Tegra210 vi i2c 2020-07-28 18:32:54 +02: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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00
i2c-xiic.c i2c: xiic: fix indentation issue 2020-01-29 21:53:51 +01: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
i2c-zx2967.c i2c: busses: convert to devm_platform_ioremap_resource 2020-04-15 12:09:09 +02:00
Kconfig i2c: i801: Add support for Intel Emmitsburg PCH 2020-08-05 11:52:28 +02:00
Makefile i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver 2020-06-03 22:39:12 +02:00
scx200_acb.c i2c: busses: Use fallthrough pseudo-keyword 2020-07-23 22:04:08 +02:00