linux-stable/drivers/platform/x86
João Paulo Rechi Vita 4888ced6b7 platform/x86: asus-wmi: Fix NULL pointer dereference
[ Upstream commit 32ffd6e8d1 ]

Do not perform the rfkill cleanup routine when
(asus->driver->wlan_ctrl_by_user && ashs_present()) is true, since
nothing is registered with the rfkill subsystem in that case. Doing so
leads to the following kernel NULL pointer dereference:

  BUG: unable to handle kernel NULL pointer dereference at           (null)
  IP: [<ffffffff816c7348>] __mutex_lock_slowpath+0x98/0x120
  PGD 1a3aa8067
  PUD 1a3b3d067
  PMD 0

  Oops: 0002 [#1] PREEMPT SMP
  Modules linked in: bnep ccm binfmt_misc uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core hid_a4tech videodev x86_pkg_temp_thermal intel_powerclamp coretemp ath3k btusb btrtl btintel bluetooth kvm_intel snd_hda_codec_hdmi kvm snd_hda_codec_realtek snd_hda_codec_generic irqbypass crc32c_intel arc4 i915 snd_hda_intel snd_hda_codec ath9k ath9k_common ath9k_hw ath i2c_algo_bit snd_hwdep mac80211 ghash_clmulni_intel snd_hda_core snd_pcm snd_timer cfg80211 ehci_pci xhci_pci drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm xhci_hcd ehci_hcd asus_nb_wmi(-) asus_wmi sparse_keymap r8169 rfkill mxm_wmi serio_raw snd mii mei_me lpc_ich i2c_i801 video soundcore mei i2c_smbus wmi i2c_core mfd_core
  CPU: 3 PID: 3275 Comm: modprobe Not tainted 4.9.34-gentoo #34
  Hardware name: ASUSTeK COMPUTER INC. K56CM/K56CM, BIOS K56CM.206 08/21/2012
  task: ffff8801a639ba00 task.stack: ffffc900014cc000
  RIP: 0010:[<ffffffff816c7348>]  [<ffffffff816c7348>] __mutex_lock_slowpath+0x98/0x120
  RSP: 0018:ffffc900014cfce0  EFLAGS: 00010282
  RAX: 0000000000000000 RBX: ffff8801a54315b0 RCX: 00000000c0000100
  RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff8801a54315b4
  RBP: ffffc900014cfd30 R08: 0000000000000000 R09: 0000000000000002
  R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801a54315b4
  R13: ffff8801a639ba00 R14: 00000000ffffffff R15: ffff8801a54315b8
  FS:  00007faa254fb700(0000) GS:ffff8801aef80000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000000000 CR3: 00000001a3b1b000 CR4: 00000000001406e0
  Stack:
   ffff8801a54315b8 0000000000000000 ffffffff814733ae ffffc900014cfd28
   ffffffff8146a28c ffff8801a54315b0 0000000000000000 ffff8801a54315b0
   ffff8801a66f3820 0000000000000000 ffffc900014cfd48 ffffffff816c73e7
  Call Trace:
   [<ffffffff814733ae>] ? acpi_ut_release_mutex+0x5d/0x61
   [<ffffffff8146a28c>] ? acpi_ns_get_node+0x49/0x52
   [<ffffffff816c73e7>] mutex_lock+0x17/0x30
   [<ffffffffa00a3bb4>] asus_rfkill_hotplug+0x24/0x1a0 [asus_wmi]
   [<ffffffffa00a4421>] asus_wmi_rfkill_exit+0x61/0x150 [asus_wmi]
   [<ffffffffa00a49f1>] asus_wmi_remove+0x61/0xb0 [asus_wmi]
   [<ffffffff814a5128>] platform_drv_remove+0x28/0x40
   [<ffffffff814a2901>] __device_release_driver+0xa1/0x160
   [<ffffffff814a29e3>] device_release_driver+0x23/0x30
   [<ffffffff814a1ffd>] bus_remove_device+0xfd/0x170
   [<ffffffff8149e5a9>] device_del+0x139/0x270
   [<ffffffff814a5028>] platform_device_del+0x28/0x90
   [<ffffffff814a50a2>] platform_device_unregister+0x12/0x30
   [<ffffffffa00a4209>] asus_wmi_unregister_driver+0x19/0x30 [asus_wmi]
   [<ffffffffa00da0ea>] asus_nb_wmi_exit+0x10/0xf26 [asus_nb_wmi]
   [<ffffffff8110c692>] SyS_delete_module+0x192/0x270
   [<ffffffff810022b2>] ? exit_to_usermode_loop+0x92/0xa0
   [<ffffffff816ca560>] entry_SYSCALL_64_fastpath+0x13/0x94
  Code: e8 5e 30 00 00 8b 03 83 f8 01 0f 84 93 00 00 00 48 8b 43 10 4c 8d 7b 08 48 89 63 10 41 be ff ff ff ff 4c 89 3c 24 48 89 44 24 08 <48> 89 20 4c 89 6c 24 10 eb 1d 4c 89 e7 49 c7 45 08 02 00 00 00
  RIP  [<ffffffff816c7348>] __mutex_lock_slowpath+0x98/0x120
   RSP <ffffc900014cfce0>
  CR2: 0000000000000000
  ---[ end trace 8d484233fa7cb512 ]---
  note: modprobe[3275] exited with preempt_count 2

https://bugzilla.kernel.org/show_bug.cgi?id=196467

Reported-by: red.f0xyz@gmail.com
Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-08 15:30:53 +02:00
..
acer-wmi.c platform/x86: acer-wmi: Using zero as first WMI instance number 2017-06-20 20:23:17 +03:00
acerhdf.c platform/x86: acerhdf: Add const to thermal_cooling_device_ops structure 2017-06-21 14:12:46 -07:00
alienware-wmi.c platform/x86: alienware-wmi: fix format string overflow warning 2017-07-25 20:54:03 +03:00
amilo-rfkill.c
apple-gmux.c Revert "apple-gmux: lock iGP IO to protect from vgaarb changes" 2018-02-22 15:42:26 +01:00
asus-laptop.c platform/x86: asus-laptop: remove sparse_keymap_free() calls 2017-03-14 22:58:02 -07:00
asus-nb-wmi.c platform/x86: asus-wmi: try to set als by default 2017-04-28 21:52:24 +03:00
asus-wireless.c platform/x86: asus-wireless: Fix NULL pointer dereference 2018-05-09 09:51:55 +02:00
asus-wmi.c platform/x86: asus-wmi: Fix NULL pointer dereference 2018-07-08 15:30:53 +02:00
asus-wmi.h platform/x86: asus-wmi: try to set als by default 2017-04-28 21:52:24 +03:00
classmate-laptop.c
compal-laptop.c dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
dell-laptop.c platform/x86: dell-laptop: Filter out spurious keyboard backlight change events 2018-04-26 11:02:04 +02:00
dell-rbtn.c platform/x86: dell-rbtn: constify rfkill_ops structures 2017-06-13 11:00:21 -07:00
dell-rbtn.h
dell-smbios.c platform/x86: dell-*: Add a generic dell-laptop notifier chain 2017-04-13 10:12:19 -07:00
dell-smbios.h platform/x86: dell-*: Add a generic dell-laptop notifier chain 2017-04-13 10:12:19 -07:00
dell-smo8800.c x86: separate extable.h, switch sections.h to it 2016-09-27 21:15:23 -04:00
dell-wmi-aio.c platform/x86: dell-wmi-aio: remove sparse_keymap_free() calls 2017-03-14 22:58:04 -07:00
dell-wmi-led.c platform/x86: dell-wmi-led: Adjust instance of wmi_evaluate_method calls to 0 2017-06-28 09:01:36 -07:00
dell-wmi.c platform/x86: dell-wmi: Update dell_wmi_check_descriptor_buffer() to new model 2017-08-18 17:06:32 -07:00
eeepc-laptop.c platform/x86: eeepc-laptop: constify platform_attribute_group 2017-06-30 20:13:01 -07:00
eeepc-wmi.c
fujitsu-laptop.c platform/x86: fujitsu-laptop: Don't oops when FUJ02E3 is not presnt 2017-09-27 00:04:43 -07:00
fujitsu-tablet.c
hdaps.c dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
hp-wireless.c platform/x86: hp-wireless: reuse module_acpi_driver 2017-04-28 21:51:25 +03:00
hp-wmi.c platform/x86: hp-wmi: Fix tablet mode detection for convertibles 2017-12-05 11:26:27 +01:00
hp_accel.c platform/x86: hp_accel: Add quirk for HP ProBook 440 G4 2017-12-20 10:10:31 +01:00
ibm_rtl.c dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
ideapad-laptop.c platform/x86: ideapad-laptop: Expose conservation mode switch 2017-08-14 23:27:12 +03:00
intel-hid.c platform-drivers-x86 for v4.14-1 2017-09-08 16:04:50 -07:00
intel-rst.c
intel-smartconnect.c platform/x86: Use ACPI_FAILURE at appropriate places 2016-12-13 09:29:01 -08:00
intel-vbtn.c platform/x86: intel-vbtn: reduce unnecessary messages for normal users 2017-08-18 16:23:15 -07:00
intel_bxtwc_tmu.c platform/x86: intel_bxtwc_tmu: Remove first level IRQ unmask 2017-06-19 15:45:30 +01:00
intel_cht_int33fe.c platform/x86: intel_cht_int33fe: Set supplied-from property on max17047 dev 2017-05-31 13:21:00 +03:00
intel_int0002_vgpio.c platform/x86: Add driver for ACPI INT0002 Virtual GPIO device 2017-06-15 00:55:44 +02:00
intel_ips.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/loadavg.h> 2017-03-02 08:42:27 +01:00
intel_ips.h
intel_menlow.c platform/x86: intel_menlow: Add const to thermal_cooling_device_ops structure 2017-06-21 14:13:10 -07:00
intel_mid_powerbtn.c platform/x86: intel_mid_powerbtn: make mid_pb_ddata const 2017-08-13 15:27:10 +03:00
intel_mid_thermal.c platform/x86: intel_mid_thermal: Fix module autoload 2017-02-03 14:04:53 +02:00
intel_oaktrail.c dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
intel_pmc_core.c platform/x86: intel_pmc_core: Make the driver PCH family agnostic 2017-08-13 16:01:22 +03:00
intel_pmc_core.h platform/x86: intel_pmc_core: Make the driver PCH family agnostic 2017-08-13 16:01:22 +03:00
intel_pmc_ipc.c platform/x86: intel_pmc_ipc: Use spin_lock to protect GCR updates 2017-10-23 20:16:36 +03:00
intel_punit_ipc.c platform/x86: intel_punit_ipc: Fix resource ioremap warning 2017-12-20 10:10:25 +01:00
intel_scu_ipc.c platform/x86: intel_scu_ipc: make intel_scu_ipc_pdata_t const 2017-08-13 15:27:10 +03:00
intel_scu_ipcutil.c
intel_telemetry_core.c
intel_telemetry_debugfs.c platform/x86: intel_telemetry: Add GLK PSS Event Table 2017-07-25 20:54:03 +03:00
intel_telemetry_pltdrv.c platform/x86: intel_telemetry: remove redundant macro definition 2017-07-25 20:54:04 +03:00
intel_turbo_max_3.c platform/x86: intel_turbo_max_3: make it explicitly non-modular 2017-02-24 23:48:54 -08:00
Kconfig platform/x86: peaq-wmi: select INPUT_POLLDEV 2017-07-20 16:57:51 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mlx-platform.c dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
mlxcpld-hotplug.c platform/x86: Introduce support for Mellanox hotplug driver 2016-10-23 07:52:57 -07:00
msi-laptop.c dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
msi-wmi.c platform/x86: msi-wmi: remove unnecessary static in msi_wmi_notify() 2017-07-25 09:56:38 -07:00
mxm-wmi.c platform/x86: mxm-wmi: Evaluate wmi method with instance number 0x0 2017-08-13 15:55:05 +03:00
panasonic-laptop.c platform/x86: panasonic-laptop: constify attribute_group structures. 2017-07-11 09:22:53 -07:00
peaq-wmi.c platform/x86: peaq_wmi: Fix missing terminating entry for peaq_dmi_table 2017-11-21 09:49:23 +01:00
pmc_atom.c platform/x86: Enable Atom PMC platform clocks 2017-01-26 16:21:59 -08:00
pvpanic.c
samsung-laptop.c dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
samsung-q10.c dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
silead_dmi.c platform/x86: silead_dmi: Add entry for Ployer Momo7w tablet touchscreen 2017-07-12 13:57:42 -07:00
sony-laptop.c dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
surface3-wmi.c platform/x86: surface3-wmi: fix uninitialized symbol 2017-01-21 01:43:42 +02:00
surface3_button.c platform/x86: surface3_button: Propagate error from gpiod_count() 2017-03-16 21:52:12 +01:00
surfacepro3_button.c
tc1100-wmi.c
thinkpad_acpi.c platform/x86: thinkpad_acpi: suppress warning about palm detection 2018-04-26 11:02:11 +02:00
topstar-laptop.c platform/x86: topstar-laptop: Add new device id 2017-05-15 16:15:50 -07:00
toshiba-wmi.c dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
toshiba_acpi.c platform/x86: toshiba_acpi: constify attribute_group structures. 2017-07-11 09:22:55 -07:00
toshiba_bluetooth.c platform/x86: toshiba_bluetooth: Decouple an error checking status code 2016-09-23 16:21:06 -07:00
toshiba_haps.c platform/x86: toshiba_haps: constify haps_attr_group 2017-06-28 09:01:37 -07:00
wmi-bmof.c platform/x86: wmi*: Add recent copyright statements 2017-06-13 11:00:18 -07:00
wmi.c platform/x86: wmi: Call acpi_wmi_init() later 2018-01-17 09:45:18 +01:00
xo1-rfkill.c
xo15-ebook.c