Frank Li
e79c1f1c91
spi: spi-fsl-dspi: Fix crash when not using GPIO chip select
[ Upstream commit 25f00a13dccf8e45441265768de46c8bf58e08f6 ]
Add check for the return value of spi_get_csgpiod() to avoid passing a NULL
pointer to gpiod_direction_output(), preventing a crash when GPIO chip
select is not used.
Fix below crash:
[ 4.251960] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[ 4.260762] Mem abort info:
[ 4.263556] ESR = 0x0000000096000004
[ 4.267308] EC = 0x25: DABT (current EL), IL = 32 bits
[ 4.272624] SET = 0, FnV = 0
[ 4.275681] EA = 0, S1PTW = 0
[ 4.278822] FSC = 0x04: level 0 translation fault
[ 4.283704] Data abort info:
[ 4.286583] ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
[ 4.292074] CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[ 4.297130] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[ 4.302445] [0000000000000000] user address but active_mm is swapper
[ 4.308805] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
[ 4.315072] Modules linked in:
[ 4.318124] CPU: 2 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-rc4-next-20241023-00008-ga20ec42c5fc1 #359
[ 4.328130] Hardware name: LS1046A QDS Board (DT)
[ 4.332832] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 4.339794] pc : gpiod_direction_output+0x34/0x5c
[ 4.344505] lr : gpiod_direction_output+0x18/0x5c
[ 4.349208] sp : ffff80008003b8f0
[ 4.352517] x29: ffff80008003b8f0 x28: 0000000000000000 x27: ffffc96bcc7e9068
[ 4.359659] x26: ffffc96bcc6e00b0 x25: ffffc96bcc598398 x24: ffff447400132810
[ 4.366800] x23: 0000000000000000 x22: 0000000011e1a300 x21: 0000000000020002
[ 4.373940] x20: 0000000000000000 x19: 0000000000000000 x18: ffffffffffffffff
[ 4.381081] x17: ffff44740016e600 x16: 0000000500000003 x15: 0000000000000007
[ 4.388221] x14: 0000000000989680 x13: 0000000000020000 x12: 000000000000001e
[ 4.395362] x11: 0044b82fa09b5a53 x10: 0000000000000019 x9 : 0000000000000008
[ 4.402502] x8 : 0000000000000002 x7 : 0000000000000007 x6 : 0000000000000000
[ 4.409641] x5 : 0000000000000200 x4 : 0000000002000000 x3 : 0000000000000000
[ 4.416781] x2 : 0000000000022202 x1 : 0000000000000000 x0 : 0000000000000000
[ 4.423921] Call trace:
[ 4.426362] gpiod_direction_output+0x34/0x5c (P)
[ 4.431067] gpiod_direction_output+0x18/0x5c (L)
[ 4.435771] dspi_setup+0x220/0x334
Fixes: 9e264f3f85 ("spi: Replace all spi->chip_select and spi->cs_gpiod references with function call")
Cc: stable@vger.kernel.org
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20241023203032.1388491-1-Frank.Li@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-08 16:28:25 +01:00
..
2024-10-04 16:30:05 +02:00
2024-01-25 15:35:14 -08:00
2023-08-18 22:46:19 +01:00
2023-03-11 12:34:01 +00:00
2022-12-29 13:22:04 +00:00
2022-12-29 13:22:05 +00:00
2023-08-14 13:11:15 +01:00
2023-08-14 13:10:48 +01:00
2023-07-14 20:53:00 +01:00
2023-07-14 20:53:00 +01:00
2023-08-07 14:38:18 +01:00
2023-08-22 13:51:35 +01:00
2023-07-11 14:12:56 +01:00
2024-01-01 12:42:44 +00:00
2023-08-14 13:10:49 +01:00
2024-05-17 12:02:01 +02:00
2023-08-07 14:38:23 +01:00
2024-10-10 11:57:44 +02:00
2023-08-07 21:59:25 +01:00
2023-08-07 21:59:25 +01:00
2024-01-31 16:19:13 -08:00
2024-10-04 16:29:03 +02:00
2023-07-11 13:41:20 +01:00
2023-07-11 14:12:56 +01:00
2023-03-06 12:31:15 +00:00
2023-08-07 14:38:25 +01:00
2024-03-06 14:48:34 +00:00
2024-07-11 12:49:21 +02:00
2024-10-10 11:57:40 +02:00
2023-08-07 14:38:29 +01:00
2023-08-07 14:38:30 +01:00
2023-03-11 12:34:01 +00:00
2023-08-07 14:38:28 +01:00
2024-01-25 15:35:55 -08:00
2024-06-27 13:49:08 +02:00
2023-08-07 14:38:31 +01:00
2023-08-07 14:38:32 +01:00
2023-03-06 12:31:21 +00:00
2023-08-07 14:38:33 +01:00
2023-08-07 14:38:33 +01:00
2023-08-16 12:58:07 +01:00
2023-08-07 14:38:33 +01:00
2023-08-14 13:10:50 +01:00
2023-08-14 13:10:51 +01:00
2023-08-14 13:10:52 +01:00
2023-08-09 12:52:49 +01:00
2024-11-08 16:28:25 +01:00
2023-08-14 13:10:54 +01:00
2023-07-14 20:53:00 +01:00
2023-07-25 17:40:28 +01:00
2024-10-17 15:24:11 +02:00
2023-08-14 13:10:55 +01:00
2023-08-14 13:10:56 +01:00
2024-11-08 16:28:17 +01:00
2023-08-14 13:10:57 +01:00
2023-09-27 17:06:36 +02:00
2024-09-12 11:11:38 +02:00
2024-03-01 13:34:49 +01:00
2023-08-14 13:11:01 +01:00
2024-10-10 11:57:40 +02:00
2023-08-14 13:11:03 +01:00
2024-03-26 18:19:10 -04:00
2023-08-14 13:11:04 +01:00
2023-08-21 13:10:56 +01:00
2023-08-14 13:11:05 +01:00
2023-08-14 13:11:06 +01:00
2023-07-31 15:57:09 +01:00
2023-07-31 15:57:09 +01:00
2023-07-31 15:57:09 +01:00
2023-07-31 15:57:09 +01:00
2023-07-14 20:53:00 +01:00
2023-07-14 20:53:00 +01:00
2023-03-11 12:34:01 +00:00
2023-07-14 20:53:00 +01:00
2023-03-06 12:31:33 +00:00
2024-05-17 12:02:36 +02:00
2024-08-03 08:54:40 +02:00
2023-08-07 18:37:54 +01:00
2023-03-11 12:34:01 +00:00
2023-08-03 17:07:09 +01:00
2024-03-26 18:20:13 -04:00
2023-07-14 20:53:00 +01:00
2023-07-14 20:53:00 +01:00
2023-07-14 20:53:00 +01:00
2024-07-25 09:50:56 +02:00
2023-03-11 12:34:01 +00:00
2023-07-11 14:14:31 +01:00
2023-10-02 15:03:19 +01:00
2023-03-06 21:17:50 +00:00
2024-10-04 16:30:03 +02:00
2023-03-06 21:17:51 +00:00
2023-11-20 11:59:08 +01:00
2023-07-11 14:14:31 +01:00
2023-08-21 14:29:18 +01:00
2024-04-10 16:36:01 +02:00
2023-08-21 14:29:20 +01:00
2023-08-21 14:29:21 +01:00
2023-08-21 14:29:22 +01:00
2024-10-04 16:29:02 +02:00
2023-08-21 14:29:24 +01:00
2023-08-21 14:29:25 +01:00
2023-08-21 14:29:26 +01:00
2023-08-21 14:29:27 +01:00
2023-08-21 14:29:28 +01:00
2023-08-21 14:29:29 +01:00
2024-09-12 11:11:27 +02:00
2024-10-10 11:57:41 +02:00
2023-08-21 14:29:30 +01:00
2023-08-21 14:29:31 +01:00
2024-10-10 11:57:40 +02:00
2023-08-21 14:29:33 +01:00
2023-08-21 14:29:34 +01:00
2024-03-01 13:34:51 +01:00
2023-08-21 14:29:36 +01:00
2023-08-21 14:29:37 +01:00
2023-08-21 14:29:38 +01:00
2023-07-11 13:41:25 +01:00
2023-08-21 14:29:39 +01:00
2023-07-14 20:53:00 +01:00
2023-07-14 20:53:00 +01:00
2023-03-11 12:34:01 +00:00
2024-06-27 13:49:14 +02:00
2024-06-12 11:12:59 +02:00
2023-03-11 12:34:01 +00:00
2023-09-07 15:49:20 -07:00
2023-03-06 21:18:18 +00:00
2023-03-11 12:34:01 +00:00
2023-07-26 16:30:19 +01:00
2023-11-20 11:59:04 +01:00
2023-08-15 19:55:00 +01:00
2023-07-14 20:53:00 +01:00
2023-07-14 20:53:00 +01:00
2023-03-11 12:34:01 +00:00
2023-03-06 21:18:24 +00:00
2023-07-14 20:53:00 +01:00
2023-07-11 14:14:31 +01:00
2023-03-28 14:49:37 +01:00
2023-03-11 12:34:01 +00:00
2023-07-11 13:41:20 +01:00
2023-08-07 14:38:39 +01:00
2023-09-19 13:17:52 +01:00
2024-07-25 09:50:47 +02:00
2024-09-30 16:25:12 +02:00