whatawurst / android_kernel_sony_msm8998

LineageOS Kernel Tree for Sony Xperia XZ Premium, XZ1 and XZ1 Compact
Other
40 stars 73 forks source link

Faulty MMC driver modification #78

Closed Flamefire closed 1 year ago

Flamefire commented 1 year ago

I found this in the logs:

 : name len 0
 : ------------[ cut here ]------------
 : WARNING: at ../../../../../../../repo19/kernel/sony/msm8998/fs/proc/generic.c:369
...
Call trace:
...
[<ffffff97b9e8b5f8>] __proc_create+0x94/0x1d8
[<ffffff97b9e8ba68>] proc_mkdir+0x38/0xbc
[<ffffff97b9d16740>] register_handler_proc+0xc0/0x128
[<ffffff97b9d1117c>] __setup_irq+0x650/0x698
[<ffffff97b9d1157c>] request_threaded_irq+0xe4/0x158
[<ffffff97b9d14450>] devm_request_threaded_irq+0x74/0xc0
[<ffffff97ba7ebd4c>] mmc_gpiod_request_cd_irq+0x108/0x138
[<ffffff97ba7dc0d8>] mmc_start_host+0x64/0x98
[<ffffff97ba7deae8>] mmc_add_host+0x128/0x160
[<ffffff97ba8004c4>] sdhci_add_host+0xf38/0x1138
[<ffffff97ba80a640>] sdhci_msm_probe+0x21e0/0x24c0
[<ffffff97ba360170>] platform_drv_probe+0x48/0x9c
[<ffffff97ba35d91c>] driver_probe_device+0x3b0/0x4e4
[<ffffff97ba35dca0>] __driver_attach+0x64/0x90
[<ffffff97ba35b478>] bus_for_each_dev+0x80/0xc8
[<ffffff97ba35dc34>] driver_attach+0x20/0x28
[<ffffff97ba35be58>] driver_attach_async+0x14/0x50
[<ffffff97b9ccfe60>] async_run_entry_fn+0x54/0x150
[<ffffff97b9cc7ec0>] process_one_work+0x1cc/0x488
[<ffffff97b9cc7968>] worker_thread+0x240/0x49c
[<ffffff97b9cccd64>] kthread+0xf4/0x13c
[<ffffff97b9c832b0>] ret_from_fork+0x10/0x20

I traced this down to the commit 6ac29dadb4423df44844da008436a5b75fc82dbe which adds a field bool suspended; to the end of struct mmc_gpio. That is very likely misplaced: It should likely be after the other added bool. At that place setting the bool overwrites the string at the end of the array (the zero-length array at the end of the struct is C-language variable length struct)

@derfelot it says "Taken from Sony 47.2.A.10.107 stock kernel", where exactly did you get this from? I'd like to verify with the original sources.

Edit: Found the copyleft archive but no commit. The issue/bug is present there as well.

derfelot commented 1 year ago

I finally have some time to go through all these :)

"Taken from Sony 47.2.A.10.107 stock kernel" refers to Sony-specific addition, when compared to the standard CAF kernel. We don't have a commit history in the copyleft kernel from Sony unfortunately, only version bumps based on diff's.

Thanks