linux/drivers/gpio
Ville Syrjälä 7df89e92a5 gpiolib-acpi: Duplicate con_id string when adding it to the crs lookup list
Calling gpiod_get() from a module and then unloading the module leads to an
oops due to acpi_can_fallback_to_crs() storing the pointer to the passed
'con_id' string onto acpi_crs_lookup_list. The next guy to come along will then
try to access the string but the memory may now be gone with the module.
Make a copy of the passed string instead, and store the copy on the list.

BUG: unable to handle kernel paging request at ffffffffa03e7855
IP: [<ffffffff81338322>] strcmp+0x12/0x30
PGD 2a07067 PUD 2a08063 PMD 74720067 PTE 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: i915(+) drm_kms_helper drm intel_gtt snd_hda_codec snd_hda_core i2c_algo_bit syscopya
rea sysfillrect sysimgblt fb_sys_fops agpgart snd_soc_sst_bytcr_rt5640 coretemp hwmon intel_rapl intel_soc_dts_thermal
punit_atom_debug snd_soc_rt5640 snd_soc_rl6231 serio snd_intel_sst_acpi snd_intel_sst_core video snd_soc_sst_mfld_platf
orm snd_soc_sst_match backlight int3402_thermal processor_thermal_device int3403_thermal int3400_thermal acpi_thermal_r
el snd_soc_core intel_soc_dts_iosf int340x_thermal_zone snd_compress i2c_hid hid snd_pcm snd_timer snd soundcore evdev
sch_fq_codel efivarfs ipv6 autofs4 [last unloaded: drm]
CPU: 2 PID: 3064 Comm: modprobe Tainted: G     U  W       4.6.0-rc3-ffrd-ipvr+ #302
Hardware name: Intel Corp. VALLEYVIEW C0 PLATFORM/BYT-T FFD8, BIOS BLAKFF81.X64.0088.R10.1403240443 FFD8
_X64_R_2014_13_1_00 03/24/2014
task: ffff8800701cd200 ti: ffff880070034000 task.ti: ffff880070034000
RIP: 0010:[<ffffffff81338322>]  [<ffffffff81338322>] strcmp+0x12/0x30
RSP: 0000:ffff880070037748  EFLAGS: 00010286
RAX: 0000000080000000 RBX: ffff88007a342800 RCX: 0000000000000006
RDX: 0000000000000006 RSI: ffffffffa054f856 RDI: ffffffffa03e7856
RBP: ffff880070037748 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffa054f855
R13: ffff88007281cae0 R14: 0000000000000010 R15: ffffffffffffffea
FS:  00007faa51447700(0000) GS:ffff880079300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffa03e7855 CR3: 0000000041eba000 CR4: 00000000001006e0
Stack:
 ffff880070037770 ffffffff8136ad28 ffffffffa054f855 0000000000000000
 ffff88007a0a2098 ffff8800700377e8 ffffffff8136852e ffff88007a342800
 00000007700377a0 ffff8800700377a0 ffffffff81412442 70672d6c656e6170
Call Trace:
 [<ffffffff8136ad28>] acpi_can_fallback_to_crs+0x88/0x100
 [<ffffffff8136852e>] gpiod_get_index+0x25e/0x310
 [<ffffffff81412442>] ? mipi_dsi_attach+0x22/0x30
 [<ffffffff813685f2>] gpiod_get+0x12/0x20
 [<ffffffffa04fcf41>] intel_dsi_init+0x421/0x480 [i915]
 [<ffffffffa04d3783>] intel_modeset_init+0x853/0x16b0 [i915]
 [<ffffffffa0504864>] ? intel_setup_gmbus+0x214/0x260 [i915]
 [<ffffffffa0510158>] i915_driver_load+0xdc8/0x19b0 [i915]
 [<ffffffff8160fb53>] ? _raw_spin_unlock_irqrestore+0x43/0x70
 [<ffffffffa026b13b>] drm_dev_register+0xab/0xc0 [drm]
 [<ffffffffa026d7b3>] drm_get_pci_dev+0x93/0x1f0 [drm]
 [<ffffffff8160fb53>] ? _raw_spin_unlock_irqrestore+0x43/0x70
 [<ffffffffa043f1f4>] i915_pci_probe+0x34/0x50 [i915]
 [<ffffffff81379751>] pci_device_probe+0x91/0x100
 [<ffffffff8141a75a>] driver_probe_device+0x20a/0x2d0
 [<ffffffff8141a8be>] __driver_attach+0x9e/0xb0
 [<ffffffff8141a820>] ? driver_probe_device+0x2d0/0x2d0
 [<ffffffff81418439>] bus_for_each_dev+0x69/0xa0
 [<ffffffff8141a04e>] driver_attach+0x1e/0x20
 [<ffffffff81419c20>] bus_add_driver+0x1c0/0x240
 [<ffffffff8141b6d0>] driver_register+0x60/0xe0
 [<ffffffff81377d20>] __pci_register_driver+0x60/0x70
 [<ffffffffa026d9f4>] drm_pci_init+0xe4/0x110 [drm]
 [<ffffffff810ce04e>] ? trace_hardirqs_on+0xe/0x10
 [<ffffffffa02f1000>] ? 0xffffffffa02f1000
 [<ffffffffa02f1094>] i915_init+0x94/0x9b [i915]
 [<ffffffff810003bb>] do_one_initcall+0x8b/0x1c0
 [<ffffffff810eb616>] ? rcu_read_lock_sched_held+0x86/0x90
 [<ffffffff811de6d6>] ? kmem_cache_alloc_trace+0x1f6/0x270
 [<ffffffff81183826>] do_init_module+0x60/0x1dc
 [<ffffffff81115a8d>] load_module+0x1d0d/0x2390
 [<ffffffff811120b0>] ? __symbol_put+0x70/0x70
 [<ffffffff811f41b2>] ? kernel_read_file+0x92/0x120
 [<ffffffff811162f4>] SYSC_finit_module+0xa4/0xb0
 [<ffffffff8111631e>] SyS_finit_module+0xe/0x10
 [<ffffffff81001ff3>] do_syscall_64+0x63/0x350
 [<ffffffff816103da>] entry_SYSCALL64_slow_path+0x25/0x25
Code: f7 48 8d 76 01 48 8d 52 01 0f b6 4e ff 84 c9 88 4a ff 75 ed 5d c3 0f 1f 00 55 48 89 e5 eb 04 84 c0
 74 18 48 8d 7f 01 48 8d 76 01 <0f> b6 47 ff 3a 46 ff 74 eb 19 c0 83 c8 01 5d c3 31 c0 5d c3 66
RIP  [<ffffffff81338322>] strcmp+0x12/0x30
 RSP <ffff880070037748>
CR2: ffffffffa03e7855

v2: Make the copied con_id const

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: stable@vger.kernel.org
Fixes: 10cf4899f8 ("gpiolib: tighten up ACPI legacy gpio lookups")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-04-30 13:51:59 +02:00
..
Kconfig - New Drivers 2016-03-18 10:15:11 -07:00
Makefile - New Drivers 2016-03-18 10:15:11 -07:00
devres.c gpio: Propagate all errors in devm_get_gpiod_from_child() 2016-02-25 10:04:25 +01:00
gpio-74x164.c gpio: 74x164: use gpiochip data pointer 2016-01-05 11:21:01 +01:00
gpio-74xx-mmio.c gpio: 74xx-mmio: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:19:42 +05:30
gpio-104-dio-48e.c gpio: 104-dio-48e: Use devm_request_region 2016-02-16 00:19:51 +01:00
gpio-104-idi-48.c gpio: 104-idi-48: Use devm_request_region 2016-02-16 00:19:51 +01:00
gpio-104-idio-16.c gpio: 104-idio-16: Use devm_request_region 2016-02-16 00:19:52 +01:00
gpio-adnp.c gpio: adnp: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:19:46 +05:30
gpio-adp5520.c gpio: adp5520: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:34:06 +05:30
gpio-adp5588.c gpio: adp5588: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:34:24 +05:30
gpio-altera.c gpio: gpio-altera: Remove gpiochip on probe failure. 2016-01-27 10:50:22 +01:00
gpio-amd8111.c gpio: amd8111: Use devm_request_region 2016-02-16 00:19:52 +01:00
gpio-amdpt.c gpio: amdpt: use gpiochip data pointer 2016-01-05 11:21:02 +01:00
gpio-arizona.c gpio: arizona: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:34:29 +05:30
gpio-ath79.c gpio: ath79: Check valid gpio count for both DT and non-DT cases 2016-02-25 15:20:43 +01:00
gpio-bcm-kona.c gpio: bcm-kona: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:13 +05:30
gpio-brcmstb.c gpio: brcmstb: Use list_for_each_entry at appropriate places 2016-02-25 15:20:43 +01:00
gpio-bt8xx.c gpio: bt8xx: use gpiochip data pointer 2016-01-05 11:21:03 +01:00
gpio-clps711x.c gpio: clps711x: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:27 +05:30
gpio-crystalcove.c gpio: crystalcove: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:27 +05:30
gpio-cs5535.c gpio: cs5535: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:28 +05:30
gpio-da9052.c gpio: da9052: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:29 +05:30
gpio-da9055.c gpio: da9055: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:29 +05:30
gpio-davinci.c Merge branch 'devel' into for-next 2016-02-22 13:47:49 +01:00
gpio-dln2.c gpio: dln2: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:30 +05:30
gpio-dwapb.c gpio: generic: factor into gpio_chip struct 2016-01-05 11:21:00 +01:00
gpio-em.c gpio: em: use gpiochip data pointer 2016-01-05 11:21:05 +01:00
gpio-ep93xx.c gpio: ep93xx: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:30 +05:30
gpio-etraxfs.c gpio: generic: factor into gpio_chip struct 2016-01-05 11:21:00 +01:00
gpio-f7188x.c gpio: f7188x: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:31 +05:30
gpio-ge.c gpio: ge: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:31 +05:30
gpio-generic.c gpio: generic: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:32 +05:30
gpio-grgpio.c gpio: generic: factor into gpio_chip struct 2016-01-05 11:21:00 +01:00
gpio-ich.c gpio: ich: Use devm_request_region 2016-02-16 00:19:53 +01:00
gpio-intel-mid.c gpio: intel-mid: use gpiochip data pointer 2016-01-05 11:21:05 +01:00
gpio-iop.c gpio: iop: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:32 +05:30
gpio-it87.c gpio: it87: use gpiochip data pointer 2016-01-05 11:21:06 +01:00
gpio-janz-ttl.c gpio: janz-ttl: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:33 +05:30
gpio-kempld.c gpio: kempld: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:34 +05:30
gpio-ks8695.c gpio: ks8695: remove irq_to_gpio function 2016-02-19 00:20:30 +01:00
gpio-loongson.c gpio: convert remaining users to gpiochip_add_data() 2016-01-05 11:21:20 +01:00
gpio-lp3943.c Revert "gpio: lp3943: Drop pin_used and lp3943_gpio_request/lp3943_gpio_free" 2016-03-09 22:00:27 +07:00
gpio-lpc18xx.c gpio: lpc18xx: use gpiochip data pointer 2016-01-05 11:21:06 +01:00
gpio-lpc32xx.c gpio: lpc32xx: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:35 +05:30
gpio-lynxpoint.c gpio: lynxpoint: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:35 +05:30
gpio-max730x.c gpio: max730x: use gpiochip data pointer 2016-01-05 11:21:07 +01:00
gpio-max732x.c gpio: max732x: use gpiochip data pointer 2016-01-05 11:21:07 +01:00
gpio-max7300.c gpio: Drop owner assignment from i2c_driver 2015-11-30 09:31:00 +01:00
gpio-max7301.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
gpio-mb86s7x.c gpio: mb86s7x: use gpiochip data pointer 2016-01-05 11:21:07 +01:00
gpio-mc9s08dz60.c gpio: mc9s08dz60: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:36 +05:30
gpio-mc33880.c gpio: mc33880: use gpiochip data pointer 2016-01-05 11:21:07 +01:00
gpio-mcp23s08.c gpio: mcp23s08: Fix clearing of interrupt. 2016-03-16 13:41:59 +01:00
gpio-menz127.c gpio: menz127: Drop lock field from struct men_z127_gpio 2016-03-30 10:39:39 +02:00
gpio-ml-ioh.c gpio: ml-ioh: use gpiochip data pointer 2016-01-05 11:21:08 +01:00
gpio-mm-lantiq.c gpio: mm-lantiq: Do not use gpiochip_get_data() in ltq_mm_save_regs() 2016-01-13 10:21:06 +01:00
gpio-moxart.c Merge branch 'devm-gpiochip-add-data' into devel 2016-03-08 14:41:41 +07:00
gpio-mpc8xxx.c gpio: mpc8xxx: Slightly update the code for better readability 2016-03-09 10:44:13 +07:00
gpio-mpc5200.c gpio: Include linux/gpio.h instead of asm/gpio.h 2016-02-16 00:20:03 +01:00
gpio-msic.c gpio: msic: use gpiochip data pointer 2016-01-05 11:21:09 +01:00
gpio-mvebu.c gpio: mvebu: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:37 +05:30
gpio-mxc.c gpio: mxc: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:37 +05:30
gpio-mxs.c gpio: generic: factor into gpio_chip struct 2016-01-05 11:21:00 +01:00
gpio-octeon.c gpio: octeon: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:38 +05:30
gpio-omap.c gpio: omap: drop dev field from gpio_bank structure 2016-03-09 18:07:14 +07:00
gpio-palmas.c gpio: palmas: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:40 +05:30
gpio-pca953x.c gpio: pca953x: Use correct u16 value for register word write 2016-04-08 11:49:47 +02:00
gpio-pcf857x.c gpio: pcf857x: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:39 +05:30
gpio-pch.c gpio: pch: Optimize pch_gpio_get() 2016-01-05 15:46:34 +01:00
gpio-pisosr.c gpio: pisosr: Use gpiod_set_value_cansleep in pisosr_gpio_refresh() 2016-02-25 15:20:46 +01:00
gpio-pl061.c gpio: pl061: use gpiochip data pointer 2016-01-05 11:21:11 +01:00
gpio-pxa.c gpio: pxa: fix legacy non pinctrl aware builds 2016-04-08 10:10:08 +02:00
gpio-rc5t583.c gpio: rc5t583: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:40 +05:30
gpio-rcar.c Revert "gpio: rcar: Fine-grained Runtime PM support" 2016-04-12 10:05:22 +02:00
gpio-rdc321x.c gpio: rdc321x: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:41 +05:30
gpio-sa1100.c gpio: convert remaining users to gpiochip_add_data() 2016-01-05 11:21:20 +01:00
gpio-sch.c gpio: sch: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:41 +05:30
gpio-sch311x.c gpio: sch311x: Use devm_request_region 2016-02-16 00:19:53 +01:00
gpio-sodaville.c gpio: generic: factor into gpio_chip struct 2016-01-05 11:21:00 +01:00
gpio-spear-spics.c gpio: spear-spics: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:42 +05:30
gpio-sta2x11.c gpio: sta2x11: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:42 +05:30
gpio-stmpe.c gpio: stmpe: use gpiochip data pointer 2016-01-05 11:21:14 +01:00
gpio-stp-xway.c gpio: stp-xway: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:43 +05:30
gpio-sx150x.c gpio: sx150x: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:43 +05:30
gpio-syscon.c gpio: syscon: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:44 +05:30
gpio-tb10x.c gpio: tb10x: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:44 +05:30
gpio-tc3589x.c gpio: tc3589x: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:45 +05:30
gpio-tegra.c gpio: tegra: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:46 +05:30
gpio-timberdale.c gpio: timberdale: Switch to devm_ioremap_resource() 2016-03-08 15:56:33 +07:00
gpio-tpic2810.c gpio: tpic2810: Make tpic2810_direction_output set proper output level 2016-02-16 15:56:51 +01:00
gpio-tps6586x.c gpio: tps6586x: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:47 +05:30
gpio-tps65086.c gpio: tps65086: Add GPO driver for the TPS65086 PMIC 2016-03-16 08:50:33 +00:00
gpio-tps65218.c gpio: tps65218: remove unused #include 2016-02-19 09:22:41 +01:00
gpio-tps65910.c gpio: tps65910: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:47 +05:30
gpio-tps65912.c gpio: tps65912: fix bad merge 2016-03-09 22:02:52 +07:00
gpio-ts4800.c gpio: ts4800: Drop redundant code to set already initialized gpio_chip fields 2016-02-25 15:20:44 +01:00
gpio-ts5500.c gpio: ts5500: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:49 +05:30
gpio-twl4030.c gpio: twl4030: use gpiochip data pointer 2016-01-05 11:21:16 +01:00
gpio-twl6040.c gpio: twl6040: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:50 +05:30
gpio-tz1090-pdc.c gpio: tz1090-pdc: use gpiochip data pointer 2016-01-05 11:21:16 +01:00
gpio-tz1090.c gpio: tz1090: use gpiochip data pointer 2016-01-05 11:21:16 +01:00
gpio-ucb1400.c gpio: ucb1400: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:50 +05:30
gpio-vf610.c gpio: vf610: use gpiochip data pointer 2016-01-05 11:21:17 +01:00
gpio-viperboard.c gpio: viperboard: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:51 +05:30
gpio-vr41xx.c gpio: convert remaining users to gpiochip_add_data() 2016-01-05 11:21:20 +01:00
gpio-vx855.c gpio: vx855: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:51 +05:30
gpio-wm831x.c gpio: wm8350: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:52 +05:30
gpio-wm8350.c gpio: wm8350: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:52 +05:30
gpio-wm8994.c gpio: wm8994: Use devm_gpiochip_add_data() for gpio registration 2016-02-23 20:35:53 +05:30
gpio-ws16c48.c gpio: ws16c48: Use devm_request_region 2016-02-16 00:19:54 +01:00
gpio-xgene-sb.c gpio: xgene: fix type of variable containing error codes 2016-02-25 15:20:45 +01:00
gpio-xgene.c gpio: xgene: Prevent NULL pointer dereference 2016-03-30 10:39:39 +02:00
gpio-xilinx.c gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs() 2016-01-07 10:06:56 +01:00
gpio-xlp.c gpio: xlp: use gpiochip data pointer 2016-01-05 11:21:19 +01:00
gpio-xtensa.c gpio: convert remaining users to gpiochip_add_data() 2016-01-05 11:21:20 +01:00
gpio-zevio.c gpio: zevio: use gpiochip data pointer 2016-01-05 11:21:19 +01:00
gpio-zx.c gpio: zx: use gpiochip data pointer 2016-01-05 11:21:19 +01:00
gpio-zynq.c gpio: zynq: use gpiochip data pointer 2016-01-05 11:21:20 +01:00
gpiolib-acpi.c gpiolib-acpi: Duplicate con_id string when adding it to the crs lookup list 2016-04-30 13:51:59 +02:00
gpiolib-legacy.c gpiolib: Split GPIO flags parsing and GPIO configuration 2015-10-16 22:46:46 +02:00
gpiolib-of.c gpio: of: provide optional of_mm_gpiochip_add_data() function 2016-01-05 11:20:12 +01:00
gpiolib-sysfs.c gpio: fix abi regression in sysfs 2016-02-25 16:08:45 +01:00
gpiolib.c gpiolib: Defer gpio device setup until after gpiolib initialization 2016-04-08 10:10:09 +02:00
gpiolib.h gpio: store reflect the label to userspace 2016-02-19 09:48:41 +01:00