Bug 117531

Summary: Asus EeePC 1201HA do not power-off after upgrade to 4.5
Product: Drivers Reporter: Colin Pitrat (colin.pitrat+kernelbug)
Component: Platform_x86Assignee: drivers_platform_x86 (drivers_platform_x86)
Status: RESOLVED CODE_FIX    
Severity: normal CC: colin.pitrat+kernelbug
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 4.5 Subsystem:
Regression: Yes Bisected commit-id:

Description Colin Pitrat 2016-05-02 21:13:49 UTC
Since upgrade to linux-4.5-1, my Asus EEE PC will not poweroff anymore.
Upgrading further to linux-4.5.1-1 didn't solve the issue.
Downgrading to linux-4.4.5 fixes the issue.

The only odd thing I could find by comparing dmesg of both versions is this:
mai 01 23:15:46 pitrat4 kernel: asus_wmi: ASUS WMI generic driver loaded
mai 01 23:15:46 pitrat4 kernel: BUG: unable to handle kernel NULL pointer dereference at 00000094
(...)
mai 01 23:15:48 pitrat4 kernel: IP: [<f8bfb241>] sch_gpio_probe+0x161/0x280 [gpio_sch]
mai 01 23:15:48 pitrat4 kernel: *pde = 00000000
mai 01 23:15:48 pitrat4 kernel: Oops: 0000 [#1] PREEMPT SMP
mai 01 23:15:48 pitrat4 kernel: Modules linked in: eeepc_wmi(+) gpio_sch(+) libps2 asus_wmi irqbypass snd_hda_codec cfg80211 snd_hda_core pcspkr at
mai 01 23:15:48 pitrat4 kernel: CPU: 1 PID: 235 Comm: systemd-udevd Not tainted 4.5.1-1-ARCH #1
mai 01 23:15:48 pitrat4 kernel: Hardware name: ASUSTeK Computer INC. 1201HA/1201HA, BIOS 0302 02/05/2010
mai 01 23:15:49 pitrat4 kernel: task: f5402d00 ti: f4e50000 task.ti: f4e50000
mai 01 23:15:49 pitrat4 kernel: EIP: 0060:[<f8bfb241>] EFLAGS: 00010246 CPU: 1
mai 01 23:15:49 pitrat4 kernel: EIP is at sch_gpio_probe+0x161/0x280 [gpio_sch]
mai 01 23:15:49 pitrat4 kernel: EAX: 0000000a EBX: f5656e4c ECX: 00000000 EDX: 0000000e
mai 01 23:15:49 pitrat4 kernel: ESI: f8bfc0cc EDI: 00000000 EBP: f4e51cb4 ESP: f4e51c98
mai 01 23:15:49 pitrat4 kernel: DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
mai 01 23:15:49 pitrat4 kernel: CR0: 80050033 CR2: 00000094 CR3: 34e25000 CR4: 000006d0
mai 01 23:15:49 pitrat4 kernel: Stack:
mai 01 23:15:50 pitrat4 kernel: 00000040 f4e211b0 f4e2100c f4e21000 f4e2100c f8bfd014 f4e2100c f4e51cd0
mai 01 23:15:51 pitrat4 kernel: c1387b13 f4e51cd0 c13850e2 f4e2100c 00000000 f8bfd014 f4e51d04 c1385b49
mai 01 23:15:53 pitrat4 kernel: 00000000 f4e51cf0 c130a6ac f4e2100c f8bfd014 00000000 f4e51d04 00000025
mai 01 23:15:53 pitrat4 kernel: Call Trace:
mai 01 23:15:54 pitrat4 kernel: [<c1387b13>] platform_drv_probe+0x43/0xb0
mai 01 23:15:55 pitrat4 kernel: [<c13850e2>] ? driver_sysfs_add+0x62/0x80
mai 01 23:15:56 pitrat4 kernel: [<c1385b49>] driver_probe_device+0x1f9/0x450
mai 01 23:15:57 pitrat4 kernel: [<c130a6ac>] ? acpi_driver_match_device+0x31/0x4b
mai 01 23:15:58 pitrat4 kernel: [<c1385e19>] __driver_attach+0x79/0x80
mai 01 23:15:58 pitrat4 kernel: [<c1385da0>] ? driver_probe_device+0x450/0x450
mai 01 23:15:58 pitrat4 kernel: [<c13839a7>] bus_for_each_dev+0x57/0xa0
mai 01 23:15:59 pitrat4 kernel: [<c13852be>] driver_attach+0x1e/0x20
mai 01 23:15:59 pitrat4 kernel: [<c1385da0>] ? driver_probe_device+0x450/0x450
mai 01 23:15:59 pitrat4 kernel: [<c1384dcf>] bus_add_driver+0x1ef/0x290
mai 01 23:15:59 pitrat4 kernel: [<f815c000>] ? 0xf815c000
mai 01 23:15:59 pitrat4 kernel: [<f815c000>] ? 0xf815c000
mai 01 23:16:00 pitrat4 kernel: [<c138670d>] driver_register+0x5d/0xf0
mai 01 23:16:00 pitrat4 kernel: [<c1387a7f>] __platform_driver_register+0x2f/0x40
mai 01 23:16:00 pitrat4 kernel: [<f815c012>] sch_gpio_driver_init+0x12/0x1000 [gpio_sch]
mai 01 23:16:01 pitrat4 kernel: [<c100047a>] do_one_initcall+0xaa/0x200
mai 01 23:16:01 pitrat4 kernel: [<f815c000>] ? 0xf815c000
mai 01 23:16:01 pitrat4 kernel: [<c115f525>] ? kvfree+0x45/0x50
mai 01 23:16:01 pitrat4 kernel: [<c11938be>] ? kmem_cache_alloc_trace+0x7e/0x1f0
mai 01 23:16:01 pitrat4 kernel: [<c1140fe9>] ? do_init_module+0x21/0x1a8
mai 01 23:16:01 pitrat4 kernel: [<c1140fe9>] ? do_init_module+0x21/0x1a8
mai 01 23:16:01 pitrat4 kernel: [<c1141018>] do_init_module+0x50/0x1a8
mai 01 23:16:02 pitrat4 kernel: [<c10e1cfc>] load_module+0x204c/0x25b0
mai 01 23:16:02 pitrat4 kernel: [<c10e2387>] SyS_init_module+0x127/0x180
mai 01 23:16:02 pitrat4 kernel: [<c1001b3d>] do_fast_syscall_32+0x8d/0x150
mai 01 23:16:02 pitrat4 kernel: [<c150b187>] sysenter_past_esp+0x40/0x61
mai 01 23:16:02 pitrat4 kernel: Code: ff ff 5b 5e 5f 5d c3 8d 76 00 8b 7b 10 31 c0 ba 0e 00 00 00 66 89 83 92 00 00 00 b8 0a 00 00 00 66 89 53 4c 6
mai 01 23:16:03 pitrat4 kernel: EIP: [<f8bfb241>] sch_gpio_probe+0x161/0x280 [gpio_sch] SS:ESP 0068:f4e51c98
mai 01 23:16:03 pitrat4 kernel: CR2: 0000000000000094
mai 01 23:16:03 pitrat4 kernel: ---[ end trace 159ce0d925c94927 ]---

My initial guess was that it could be due to this commit:
https://github.com/torvalds/linux/commit/f5b3f66548b72f8ab77fea5867bd45ad91ed2143#diff-a746f90c9503689310ee8f3bdc77bc4e

because:
- the releases matches (included in 4.5)
- the change is in the module where I get the BUG
- the Oops stack is about platform_drv_probe which is where the macro is called

But the change is the removal of a macro already defined in another header so I don't see how this could cause the issue !
Comment 1 Colin Pitrat 2016-05-05 20:57:22 UTC
Looking more closely at the stack, the issue is not in asus_wmi but in gpio_sch. Reproducing with a manually built kernel gives a more precise stack:

[   15.496397] EIP is at gpiochip_get_data+0xc/0x20
(...)
[   15.496397]  [<f83df013>] ? sch_gpio_reg_set+0x13/0x70 [gpio_sch]
[   15.496397]  [<f83df2d5>] sch_gpio_probe+0x165/0x1f0 [gpio_sch]
[   15.496397]  [<c1391133>] platform_drv_probe+0x43/0xb0
[   15.496397]  [<c138e632>] ? driver_sysfs_add+0x62/0x80
[   15.496397]  [<c138f099>] driver_probe_device+0x1f9/0x450
[   15.496397]  [<c13136c2>] ? acpi_driver_match_device+0x31/0x4b
[   15.496397]  [<c13916e0>] ? platform_match+0x20/0xb0
[   15.496397]  [<c138f3c9>] __driver_attach+0xd9/0x100
[   15.496397]  [<c12925e8>] ? kobject_add_internal+0x168/0x350
[   15.496397]  [<c150fe2b>] ? klist_next+0x6b/0x110
[   15.496397]  [<c138f2f0>] ? driver_probe_device+0x450/0x450
[   15.496397]  [<c138cef7>] bus_for_each_dev+0x57/0xa0
[   15.496397]  [<c138e80e>] driver_attach+0x1e/0x20
[   15.496397]  [<c138f2f0>] ? driver_probe_device+0x450/0x450
[   15.496397]  [<c138e31f>] bus_add_driver+0x1ef/0x290
[   15.496397]  [<f811e000>] ? 0xf811e000
[   15.496397]  [<f811e000>] ? 0xf811e000
[   15.496397]  [<c138fd6d>] driver_register+0x5d/0xf0
[   15.496397]  [<c139109f>] __platform_driver_register+0x2f/0x40
[   15.496397]  [<f811e012>] sch_gpio_driver_init+0x12/0x1000 [gpio_sch]
[   15.496397]  [<c100048a>] do_one_initcall+0xaa/0x200
[   15.496397]  [<f811e000>] ? 0xf811e000
[   15.496397]  [<c1165be5>] ? kvfree+0x45/0x50
[   15.496397]  [<c119affe>] ? kmem_cache_alloc_trace+0x7e/0x1f0
[   15.496397]  [<c11470a9>] ? do_init_module+0x21/0x1a8
[   15.496397]  [<c11470a9>] ? do_init_module+0x21/0x1a8
[   15.496397]  [<c11470d8>] do_init_module+0x50/0x1a8
[   15.496397]  [<c10e54a4>] load_module+0x2074/0x25d0
[   15.496397]  [<c10e5b2f>] SyS_init_module+0x12f/0x190
[   15.496397]  [<c1001b4d>] do_fast_syscall_32+0x8d/0x140
[   15.496397]  [<c151708e>] sysenter_past_esp+0x47/0x75

It looks like the following commit could be the source of the issue:
https://github.com/torvalds/linux/commit/737c8fccf1c5b2aae3c6d9a66dce17e35fc39b71
Comment 2 Colin Pitrat 2016-06-28 22:17:09 UTC
Fixed in 4.7