Anders Roxell
d95d140e83
ata: libahci_platform: ahci_platform_find_clk: oops, NULL pointer
When booting a arm 32-bit kernel with config CONFIG_AHCI_DWC enabled on
a am57xx-evm board. This happens when the clock references are unnamed
in DT, the strcmp() produces a NULL pointer dereference, see the
following oops, NULL pointer dereference:
[ 4.673950] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 4.682098] [00000000] *pgd=00000000
[ 4.685699] Internal error: Oops: 5 [#1] SMP ARM
[ 4.690338] Modules linked in:
[ 4.693420] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.1.0-rc7 #1
[ 4.699615] Hardware name: Generic DRA74X (Flattened Device Tree)
[ 4.705749] PC is at strcmp+0x0/0x34
[ 4.709350] LR is at ahci_platform_find_clk+0x3c/0x5c
[ 4.714416] pc : [<c130c494>] lr : [<c0c230e0>] psr: 20000013
[ 4.720703] sp : f000dda8 ip : 00000001 fp : c29b1840
[ 4.725952] r10: 00000020 r9 : c1b23380 r8 : c1b23368
[ 4.731201] r7 : c1ab4cc4 r6 : 00000001 r5 : c3c66040 r4 : 00000000
[ 4.737762] r3 : 00000080 r2 : 00000080 r1 : c1ab4cc4 r0 : 00000000
[...]
[ 4.998870] strcmp from ahci_platform_find_clk+0x3c/0x5c
[ 5.004302] ahci_platform_find_clk from ahci_dwc_probe+0x1f0/0x54c
[ 5.010589] ahci_dwc_probe from platform_probe+0x64/0xc0
[ 5.016021] platform_probe from really_probe+0xe8/0x41c
[ 5.021362] really_probe from __driver_probe_device+0xa4/0x204
[ 5.027313] __driver_probe_device from driver_probe_device+0x38/0xc8
[ 5.033782] driver_probe_device from __driver_attach+0xb4/0x1ec
[ 5.039825] __driver_attach from bus_for_each_dev+0x78/0xb8
[ 5.045532] bus_for_each_dev from bus_add_driver+0x17c/0x220
[ 5.051300] bus_add_driver from driver_register+0x90/0x124
[ 5.056915] driver_register from do_one_initcall+0x48/0x1e8
[ 5.062591] do_one_initcall from kernel_init_freeable+0x1cc/0x234
[ 5.068817] kernel_init_freeable from kernel_init+0x20/0x13c
[ 5.074584] kernel_init from ret_from_fork+0x14/0x2c
[ 5.079681] Exception stack(0xf000dfb0 to 0xf000dff8)
[ 5.084747] dfa0: 00000000 00000000 00000000 00000000
[ 5.092956] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 5.101165] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 5.107818] Code: e5e32001 e3520000 1afffffb e12fff1e (e4d03001)
[ 5.114013] ---[ end trace 0000000000000000 ]---
Add an extra check in the if-statement if hpriv-clks[i].id.
Fixes: 6ce73f3a6f ("ata: libahci_platform: Add function returning a clock-handle by id")
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2022-12-07 08:36:37 +09:00
..
2022-02-20 09:06:05 +09:00
2022-10-18 08:01:57 +09:00
2022-03-07 11:49:10 +09:00
2022-09-17 01:39:22 +09:00
2022-09-17 01:39:22 +09:00
2022-09-17 01:40:31 +09:00
2022-10-18 08:02:14 +09:00
2022-09-17 01:39:30 +09:00
2022-03-28 12:27:35 -07:00
2022-03-07 11:49:10 +09:00
2022-09-17 01:40:15 +09:00
2022-10-18 08:02:14 +09:00
2022-10-17 22:01:57 +09:00
2022-03-07 11:49:10 +09:00
2022-10-18 08:02:14 +09:00
2022-09-17 01:39:54 +09:00
2022-10-17 12:02:59 +09:00
2022-02-19 11:18:35 +09:00
2022-09-20 08:52:02 +09:00
2022-12-07 08:36:37 +09:00
2022-09-17 01:40:02 +09:00
2022-06-17 16:35:02 +09:00
2022-10-07 10:48:49 -07:00
2022-10-07 10:48:49 -07:00
2022-01-05 19:33:01 +09:00
2022-10-07 10:48:49 -07:00
2022-11-12 07:51:06 +09:00
2022-09-16 23:24:06 +09:00
2022-01-05 19:33:01 +09:00
2022-11-11 17:26:05 +09:00
2022-08-26 07:46:08 +09:00
2022-09-17 01:40:15 +09:00
2022-06-17 16:35:02 +09:00
2022-06-17 16:35:02 +09:00
2022-06-17 16:35:02 +09:00
2022-02-19 11:18:35 +09:00
2022-02-19 11:18:42 +09:00
2022-01-31 09:58:32 +09:00
2022-01-05 19:33:02 +09:00
2022-01-05 19:33:03 +09:00
2022-01-05 19:33:02 +09:00
2022-02-19 11:18:35 +09:00
2021-06-16 06:50:25 -06:00
2022-06-30 08:21:43 +09:00
2022-01-05 19:33:03 +09:00
2022-01-05 19:33:03 +09:00
2022-02-20 09:06:05 +09:00
2021-11-29 20:28:13 +09:00
2022-05-16 20:22:37 +09:00
2022-06-17 16:35:02 +09:00
2022-06-17 16:35:02 +09:00
2022-06-17 16:35:02 +09:00
2022-02-19 11:18:35 +09:00
2022-01-14 15:17:16 +09:00
2022-03-07 11:49:10 +09:00
2022-10-31 20:27:27 +09:00
2022-09-16 23:24:06 +09:00
2022-04-22 08:45:06 +09:00
2022-06-22 12:51:49 +10:00
2022-01-14 15:17:16 +09:00
2022-02-20 09:06:05 +09:00
2022-06-06 09:52:17 +09:00
2022-03-07 11:49:10 +09:00
2021-10-12 17:46:59 +09:00
2022-10-31 20:28:05 +09:00
2022-01-31 09:58:32 +09:00
2022-06-17 16:35:02 +09:00
2022-01-31 09:58:31 +09:00
2022-03-10 11:17:59 +09:00
2021-10-12 17:47:02 +09:00
2021-06-24 18:49:01 -06:00
2022-01-05 19:33:03 +09:00
2022-02-20 09:06:05 +09:00
2021-06-16 06:50:25 -06:00
2022-06-17 16:35:02 +09:00
2022-04-13 12:42:51 +09:00
2022-06-17 16:35:02 +09:00
2022-02-19 11:18:35 +09:00
2022-06-17 16:35:02 +09:00
2022-01-05 19:33:01 +09:00
2022-04-04 09:56:34 +09:00
2022-03-23 14:35:59 -07:00
2022-04-22 08:38:18 +09:00
2022-03-07 11:49:10 +09:00
2022-02-20 09:06:05 +09:00
2022-08-03 07:59:12 +09:00
2022-01-05 19:33:02 +09:00
2022-01-05 19:33:01 +09:00
2022-01-05 19:33:02 +09:00
2022-10-18 08:01:45 +09:00
2022-01-04 20:00:57 +09:00
2022-01-05 19:33:02 +09:00
2022-02-20 09:06:05 +09:00
2022-01-05 19:33:03 +09:00
2022-02-20 09:06:05 +09:00