linux/drivers/input/misc
Jonathan Bakker ff62b559b4 Input: bma150 - register input device after setting private data
commit 90cc55f067 upstream.

Otherwise we introduce a race condition where userspace can request input
before we're ready leading to null pointer dereference such as

input: bma150 as /devices/platform/i2c-gpio-2/i2c-5/5-0038/input/input3
Unable to handle kernel NULL pointer dereference at virtual address 00000018
pgd = (ptrval)
[00000018] *pgd=55dac831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] PREEMPT ARM
Modules linked in: bma150 input_polldev [last unloaded: bma150]
CPU: 0 PID: 2870 Comm: accelerometer Not tainted 5.0.0-rc3-dirty #46
Hardware name: Samsung S5PC110/S5PV210-based board
PC is at input_event+0x8/0x60
LR is at bma150_report_xyz+0x9c/0xe0 [bma150]
pc : [<80450f70>]    lr : [<7f0a614c>]    psr: 800d0013
sp : a4c1fd78  ip : 00000081  fp : 00020000
r10: 00000000  r9 : a5e2944c  r8 : a7455000
r7 : 00000016  r6 : 00000101  r5 : a7617940  r4 : 80909048
r3 : fffffff2  r2 : 00000000  r1 : 00000003  r0 : 00000000
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c5387d  Table: 54e34019  DAC: 00000051
Process accelerometer (pid: 2870, stack limit = 0x(ptrval))
Stackck: (0xa4c1fd78 to 0xa4c20000)
fd60:                                                       fffffff3 fc813f6c
fd80: 40410581 d7530ce3 a5e2817c a7617f00 a5e29404 a5e2817c 00000000 7f008324
fda0: a5e28000 8044f59c a5fdd9d0 a5e2945c a46a4a00 a5e29668 a7455000 80454f10
fdc0: 80909048 a5e29668 a5fdd9d0 a46a4a00 806316d0 00000000 a46a4a00 801df5f0
fde0: 00000000 d7530ce3 a4c1fec0 a46a4a00 00000000 a5fdd9d0 a46a4a08 801df53c
fe00: 00000000 801d74bc a4c1fec0 00000000 a4c1ff70 00000000 a7038da8 00000000
fe20: a46a4a00 801e91fc a411bbe0 801f2e88 00000004 00000000 80909048 00000041
fe40: 00000000 00020000 00000000 dead4ead a6a88da0 00000000 ffffe000 806fcae8
fe60: a4c1fec8 00000000 80909048 00000002 a5fdd9d0 a7660110 a411bab0 00000001
fe80: dead4ead ffffffff ffffffff a4c1fe8c a4c1fe8c d7530ce3 20000013 80909048
fea0: 80909048 a4c1ff70 00000001 fffff000 a4c1e000 00000005 00026038 801eabd8
fec0: a7660110 a411bab0 b9394901 00000006 a696201b 76fb3000 00000000 a7039720
fee0: a5fdd9d0 00000101 00000002 00000096 00000000 00000000 00000000 a4c1ff00
ff00: a6b310f4 805cb174 a6b310f4 00000010 00000fe0 00000010 a4c1e000 d7530ce3
ff20: 00000003 a5f41400 a5f41424 00000000 a6962000 00000000 00000003 00000002
ff40: ffffff9c 000a0000 80909048 d7530ce3 a6962000 00000003 80909048 ffffff9c
ff60: a6962000 801d890c 00000000 00000000 00020000 a7590000 00000004 00000100
ff80: 00000001 d7530ce3 000288b8 00026320 000288b8 00000005 80101204 a4c1e000
ffa0: 00000005 80101000 000288b8 00026320 000288b8 000a0000 00000000 00000000
ffc0: 000288b8 00026320 000288b8 00000005 7eef3bac 000264e8 00028ad8 00026038
ffe0: 00000005 7eef3300 76f76e91 76f78546 800d0030 000288b8 00000000 00000000
[<80450f70>] (input_event) from [<a5e2817c>] (0xa5e2817c)
Code: e1a08148 eaffffa8 e351001f 812fff1e (e590c018)
---[ end trace 1c691ee85f2ff243 ]---

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2019-05-02 21:41:40 +01:00
..
88pm80x_onkey.c Input: remove use of __devexit 2012-11-24 00:05:38 -08:00
88pm860x_onkey.c Input: 88pm860x_onkey - switch to using managed resources 2014-05-29 00:26:34 -07:00
ab8500-ponkey.c Input: ab8500-ponkey - switch to using managed resources 2014-05-29 00:26:36 -07:00
ad714x-i2c.c Input: ad714x - add CONFIG_PM_SLEEP to suspend/resume functions 2013-03-26 22:09:55 -07:00
ad714x-spi.c Input: ad714x-spi - remove redundant spi_set_drvdata 2013-09-20 09:58:24 -07:00
ad714x.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
ad714x.h Input: ad714x - read the interrupt status registers in a row 2011-08-22 09:59:26 -07:00
adxl34x-i2c.c Input: adxl34x - add CONFIG_PM_SLEEP to suspend/resume functions 2013-03-26 22:09:51 -07:00
adxl34x-spi.c Input: adxl34x - use spi_get_drvdata() 2013-04-07 21:02:29 -07:00
adxl34x.c Input: adxl34x - do not treat FIFO_MODE() as boolean 2018-02-13 18:42:02 +00:00
adxl34x.h Input: adxl34 - make enable/disable separate from suspend/resume 2010-07-03 13:13:21 -07:00
apanel.c Input: make i2c device ids constant 2010-01-09 23:28:33 -08:00
arizona-haptics.c ASoC: dapm: Add locking to snd_soc_dapm_xxxx_pin functions 2014-02-20 18:40:07 +09:00
ati_remote2.c Input: ati_remote2 - fix crashes on detecting device with invalid descriptor 2016-03-30 14:49:09 +01:00
atlas_btns.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2014-01-24 17:17:30 -08:00
bfin_rotary.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
bma150.c Input: bma150 - register input device after setting private data 2019-05-02 21:41:40 +01:00
cm109.c Input: cm109 - validate number of endpoints before using them 2017-07-18 18:40:16 +01:00
cma3000_d0x.c Input: use dev_get_platdata() 2013-12-06 02:06:29 -08:00
cma3000_d0x.h Input: add CMA3000 accelerometer driver 2010-11-30 23:05:21 -08:00
cma3000_d0x_i2c.c Input: remove use of __devexit 2012-11-24 00:05:38 -08:00
cobalt_btns.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
da9052_onkey.c Input: da9052_onkey - use correct register bit for key status 2014-03-26 13:33:09 -07:00
da9055_onkey.c Input: da9055_onkey - remove use of regmap_irq_get_virq() 2014-04-19 13:55:41 -07:00
dm355evm_keys.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
gp2ap002a00f.c Input: use dev_get_platdata() 2013-12-06 02:06:29 -08:00
gpio-beeper.c Input: gpio-beeper - make of_device_id array const 2014-05-14 16:39:55 -07:00
gpio_tilt_polled.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
hp_sdc_rtc.c Input: hp_sdc_rtc - unlock on error in hp_sdc_rtc_read_i8042timer() 2013-11-20 21:15:31 -08:00
ideapad_slidebar.c Input: add driver for slidebar on Lenovo IdeaPad laptops 2013-08-26 09:30:03 -07:00
ims-pcu.c Input: ims-psu - check if CDC union descriptor is sane 2018-01-01 20:52:08 +00:00
ixp4xx-beeper.c input: ixp4xx-beeper: don't use symbols from <mach/timex.h> 2013-12-20 11:44:21 +01:00
Kconfig Linux 3.15-rc5 2014-05-14 16:49:19 -07:00
keyspan_remote.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
kxtj9.c Input: use dev_get_platdata() 2013-12-06 02:06:29 -08:00
m68kspkr.c Input: m68kspkr - remove redundant platform_set_drvdata() 2013-05-28 00:57:41 -07:00
Makefile Input: add driver for SOC button array 2014-03-30 23:40:56 -07:00
max8925_onkey.c Input: max8925_onkey - switch to using managed resources 2014-05-29 00:26:35 -07:00
max8997_haptic.c Input: max8997_haptic - add error handling for regulator and pwm 2014-06-07 23:20:24 -07:00
mc13783-pwrbutton.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
mma8450.c Input: mma8450 - add missing i2c_set_clientdata() in mma8450_probe() 2013-11-11 00:01:44 -08:00
mpu3050.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
pcap_keys.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
pcf8574_keypad.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
pcf50633-input.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
pcspkr.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
pm8xxx-vibrator.c Input: pm8xxx-vibrator - add DT match table 2014-03-30 13:25:20 -07:00
pmic8xxx-pwrkey.c Input: pmic8xxx-pwrkey - fix algorithm for converting trigger delay 2016-06-15 21:29:24 +01:00
powermate.c Input: powermate - fix oops with malicious USB descriptors 2016-03-29 15:55:16 +01:00
pwm-beeper.c Input: pwm-beeper - fix - scheduling while atomic 2016-08-22 22:38:06 +01:00
rb532_button.c Input: rb532_button - remove redundant dev_set_drvdata 2013-09-18 07:53:41 -07:00
retu-pwrbutton.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
rotary_encoder.c Input: rotary_encoder - make of_device_id array const 2014-05-14 16:39:56 -07:00
sgi_btns.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
sirfsoc-onkey.c Input: sirfsoc-onkey - fix GPL v2 license string typo 2014-07-18 10:19:42 -07:00
soc_button_array.c Input: soc_button_array - remove duplicate inclusion of input.h 2014-05-28 23:35:17 -07:00
sparcspkr.c Input: misc - use platform_{get,set}_drvdata() 2013-05-23 09:34:13 -07:00
twl4030-pwrbutton.c Input: twl4030-pwrbutton - use correct device for irq request 2017-08-26 02:14:42 +01:00
twl4030-vibra.c Input: twl4030-vibra - fix sibling-node lookup 2018-03-03 15:52:17 +00:00
twl6040-vibra.c Input: twl6040-vibra - fix child-node lookup 2018-03-03 15:52:17 +00:00
uinput.c Input: uinput - avoid crash when sending FF request to device going away 2018-01-01 20:51:36 +00:00
wistron_btns.c Input: wistron_btns - add FS AMILO Pro 8210 support 2014-01-27 22:34:42 -08:00
wm831x-on.c Input: delete non-required instances of include <linux/init.h> 2014-01-06 23:23:57 -08:00
xen-kbdfront.c xen/pvhvm: If xen_platform_pci=0 is set don't blow up (v4). 2014-01-03 14:54:18 -05:00
yealink.c Input: yealink - validate number of endpoints before using them 2017-07-18 18:40:17 +01:00
yealink.h tree-wide: Assorted spelling fixes 2010-02-09 11:13:56 +01:00