linux_old1/drivers/iio/adc
Marek Vasut 8e6cb470ba iio:adc:at91-sama5d2: Repair crash on module removal
The driver never calls platform_set_drvdata() , so platform_get_drvdata()
in .remove returns NULL and thus $indio_dev variable in .remove is NULL.
Then it's only a matter of dereferencing the indio_dev variable to make
the kernel blow as seen below. This patch adds the platform_set_drvdata()
call to fix the problem.

root@armhf:~# rmmod at91-sama5d2_adc

Unable to handle kernel NULL pointer dereference at virtual address 000001d4
pgd = dd57c000
[000001d4] *pgd=00000000
Internal error: Oops: 5 [#1] ARM
Modules linked in: at91_sama5d2_adc(-)
CPU: 0 PID: 1334 Comm: rmmod Not tainted 4.6.0-rc3-next-20160418+ #3
Hardware name: Atmel SAMA5
task: dd4fcc40 ti: de910000 task.ti: de910000
PC is at mutex_lock+0x4/0x24
LR is at iio_device_unregister+0x14/0x6c
pc : [<c05f4624>]    lr : [<c0471f74>]    psr: a00d0013
               sp : de911f00  ip : 00000000  fp : be898bd8
r10: 00000000  r9 : de910000  r8 : c0107724
r7 : 00000081  r6 : bf001048  r5 : 000001d4  r4 : 00000000
r3 : bf000000  r2 : 00000000  r1 : 00000004  r0 : 000001d4
Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c53c7d  Table: 3d57c059  DAC: 00000051
Process rmmod (pid: 1334, stack limit = 0xde910208)
Stack: (0xde911f00 to 0xde912000)
1f00: bf000000 00000000 df5c7e10 bf000010 bf000000 df5c7e10 df5c7e10 c0351ca8
1f20: c0351c84 df5c7e10 bf001048 c0350734 bf001048 df5c7e10 df5c7e44 c035087c
1f40: bf001048 7f62dd4c 00000800 c034fb30 bf0010c0 c0158ee8 de910000 31397461
1f60: 6d61735f 32643561 6364615f 00000000 de911f90 de910000 de910000 00000000
1f80: de911fb0 10c53c7d de911f9c c05f33d8 de911fa0 00910000 be898ecb 7f62dd10
1fa0: 00000000 c0107560 be898ecb 7f62dd10 7f62dd4c 00000800 6f844800 6f844800
1fc0: be898ecb 7f62dd10 00000000 00000081 00000000 7f62dd10 be898bd8 be898bd8
1fe0: b6eedab1 be898b6c 7f61056b b6eedab6 000d0030 7f62dd4c 00000000 00000000
[<c05f4624>] (mutex_lock) from [<c0471f74>] (iio_device_unregister+0x14/0x6c)
[<c0471f74>] (iio_device_unregister) from [<bf000010>] (at91_adc_remove+0x10/0x3c [at91_sama5d2_adc])
[<bf000010>] (at91_adc_remove [at91_sama5d2_adc]) from [<c0351ca8>] (platform_drv_remove+0x24/0x3c)
[<c0351ca8>] (platform_drv_remove) from [<c0350734>] (__device_release_driver+0x84/0x110)
[<c0350734>] (__device_release_driver) from [<c035087c>] (driver_detach+0x8c/0x90)
[<c035087c>] (driver_detach) from [<c034fb30>] (bus_remove_driver+0x4c/0xa0)
[<c034fb30>] (bus_remove_driver) from [<c0158ee8>] (SyS_delete_module+0x110/0x1d0)
[<c0158ee8>] (SyS_delete_module) from [<c0107560>] (ret_fast_syscall+0x0/0x3c)
Code: e3520001 1affffd5 eafffff4 f5d0f000 (e1902f9f)
---[ end trace 86914d7ad3696fca ]---

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Ludovic Desroches <ludovic.desroches@atmel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-18 19:53:34 +01:00
..
Kconfig iio: adc: Fix build error of missing devm_ioremap_resource on UM 2016-03-28 09:51:19 +01:00
Makefile - New Drivers 2016-03-18 10:15:11 -07:00
ad799x.c iio: adc: ad799x: leave sysfs naming to the core 2015-09-30 18:20:53 +01:00
ad7266.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
ad7291.c
ad7298.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
ad7476.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
ad7791.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
ad7793.c First set of new device support, features and cleanups for IIO in the 4.5 cycle 2015-12-01 09:13:29 -08:00
ad7887.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
ad7923.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
ad_sigma_delta.c
at91-sama5d2_adc.c iio:adc:at91-sama5d2: Repair crash on module removal 2016-04-18 19:53:34 +01:00
at91_adc.c IIO: adc: at91_adc.c Prefer kmalloc_array over kmalloc with multiply 2015-11-22 12:06:19 +00:00
axp288_adc.c iio: adc: axp288: remove redundant duplicate const on axp288_adc_channels 2016-01-23 16:30:57 +00:00
berlin2-adc.c iio:adc:berlin2-adc: coding style cleanup 2015-08-12 22:13:57 +01:00
cc10001_adc.c iio: adc: cc10001: Power-up the ADC at probe time when used remotely 2015-06-14 12:21:22 +01:00
da9150-gpadc.c iio: Add support for DA9150 GPADC 2015-02-25 21:05:26 +01:00
exynos_adc.c iio: exynos-adc: fix irqf_oneshot.cocci warnings 2015-12-21 21:08:55 -08:00
fsl-imx25-gcq.c iio: adc/imx25-gcq: Move incorrect do_div 2016-03-09 12:50:51 +07:00
hi8435.c iio: adc: hi8435: Holt HI-8435 threshold detector 2015-09-23 20:23:18 +01:00
imx7d_adc.c iio: adc: add IMX7D ADC driver support 2015-12-12 16:25:41 +00:00
ina2xx-adc.c iio: ina2xx: Remove trace_printk debug statments 2016-02-24 20:44:20 +00:00
lp8788_adc.c
max1027.c spi: Updates for v4.4 2015-11-05 13:15:12 -08:00
max1363.c iio: adc: max1363: correct reference voltage 2016-03-20 10:32:14 +00:00
mcp320x.c iio: adc: mcp320x: support more differential voltage measurement 2016-01-16 13:04:05 +00:00
mcp3422.c iio: convert to common i2c_check_functionality() return value 2016-02-27 17:17:43 +00:00
men_z188_adc.c
mxs-lradc.c iio: adc: Move mxs-lradc out of staging 2016-02-10 19:29:37 +00:00
nau7802.c
palmas_gpadc.c iio: adc: palmas: Drop IRQF_EARLY_RESUME flag 2016-02-27 17:20:52 +00:00
qcom-spmi-iadc.c
qcom-spmi-vadc.c iio: adc: spmi-vadc: add missing of_node_put 2015-11-21 18:24:44 +00:00
rockchip_saradc.c iio: adc: rockchip_saradc: add missing MODULE_* data 2015-07-19 11:47:58 +01:00
ti-adc081c.c iio: convert to common i2c_check_functionality() return value 2016-02-27 17:17:43 +00:00
ti-adc128s052.c iio:adc128s052: add support for adc124s021 2015-12-12 12:08:17 +00:00
ti-adc0832.c iio: adc: add support for ADC0831/ADC0832/ADC0834/ADC0838 chips 2016-02-09 22:22:32 +00:00
ti-ads1015.c iio: adc: Add TI ADS1015 ADC driver support 2016-02-13 20:54:15 +00:00
ti-ads8688.c iio: adc: Add TI ADS8688 2015-11-15 10:54:44 +00:00
ti_am335x_adc.c iio:adc:ti_am335x_adc Fix buffered mode by identifying as software buffer. 2016-01-16 13:06:33 +00:00
twl4030-madc.c iio: adc: twl4030: Fix ADC[3:6] readings 2015-10-03 10:27:18 +01:00
twl6030-gpadc.c iio: adc: twl6030-gpadc: Fix module autoload for OF platform driver 2015-09-23 20:23:24 +01:00
vf610_adc.c First set of IIO fixes for the 4.4 cycle. 2015-11-18 13:15:50 -08:00
viperboard_adc.c
xilinx-xadc-core.c First set of new device support, features and cleanups for IIO in the 4.5 cycle 2015-12-01 09:13:29 -08:00
xilinx-xadc-events.c
xilinx-xadc.h iio: adc: xilinx-xadc: Push interrupts into hardirq context 2015-08-16 10:51:27 +01:00