Commit 1d4e3a6
committed
spi: Fix null dereference on suspend
JIRA: https://issues.redhat.com/browse/RHEL-38218
CVE: CVE-2023-52749
Conflicts: Due to missing commit
82238d2 ("spi: Rename SPI_MASTER_GPIO_SS to SPI_CONTROLLER_GPIO_SS")
some context diffs were introduced. That commit touches too
much of SPI, let's take that as part of a subsystem upgrade
but not for this one patch.
commit bef4a48
Author: Mark Hasemeyer <markhas@chromium.org>
Date: Tue Nov 7 14:47:43 2023 -0700
spi: Fix null dereference on suspend
A race condition exists where a synchronous (noqueue) transfer can be
active during a system suspend. This can cause a null pointer
dereference exception to occur when the system resumes.
Example order of events leading to the exception:
1. spi_sync() calls __spi_transfer_message_noqueue() which sets
ctlr->cur_msg
2. Spi transfer begins via spi_transfer_one_message()
3. System is suspended interrupting the transfer context
4. System is resumed
6. spi_controller_resume() calls spi_start_queue() which resets cur_msg
to NULL
7. Spi transfer context resumes and spi_finalize_current_message() is
called which dereferences cur_msg (which is now NULL)
Wait for synchronous transfers to complete before suspending by
acquiring the bus mutex and setting/checking a suspend flag.
Signed-off-by: Mark Hasemeyer <markhas@chromium.org>
Link: https://lore.kernel.org/r/20231107144743.v1.1.I7987f05f61901f567f7661763646cb7d7919b528@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@kernel.org
Signed-off-by: Andrew Halaney <ahalaney@redhat.com>1 parent dff1218 commit 1d4e3a6
2 files changed
+40
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3303 | 3303 | | |
3304 | 3304 | | |
3305 | 3305 | | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
3306 | 3325 | | |
3307 | 3326 | | |
3308 | | - | |
| 3327 | + | |
3309 | 3328 | | |
3310 | 3329 | | |
3311 | | - | |
3312 | | - | |
3313 | | - | |
3314 | | - | |
3315 | | - | |
3316 | | - | |
| 3330 | + | |
| 3331 | + | |
| 3332 | + | |
| 3333 | + | |
| 3334 | + | |
3317 | 3335 | | |
| 3336 | + | |
3318 | 3337 | | |
3319 | 3338 | | |
3320 | 3339 | | |
3321 | 3340 | | |
3322 | 3341 | | |
3323 | 3342 | | |
3324 | | - | |
3325 | | - | |
3326 | | - | |
3327 | | - | |
| 3343 | + | |
3328 | 3344 | | |
3329 | | - | |
3330 | | - | |
3331 | | - | |
| 3345 | + | |
3332 | 3346 | | |
| 3347 | + | |
| 3348 | + | |
| 3349 | + | |
| 3350 | + | |
| 3351 | + | |
3333 | 3352 | | |
3334 | 3353 | | |
3335 | 3354 | | |
| |||
4054 | 4073 | | |
4055 | 4074 | | |
4056 | 4075 | | |
4057 | | - | |
4058 | | - | |
| 4076 | + | |
4059 | 4077 | | |
4060 | 4078 | | |
4061 | 4079 | | |
| |||
4071 | 4089 | | |
4072 | 4090 | | |
4073 | 4091 | | |
4074 | | - | |
4075 | 4092 | | |
4076 | 4093 | | |
4077 | 4094 | | |
| |||
4094 | 4111 | | |
4095 | 4112 | | |
4096 | 4113 | | |
| 4114 | + | |
| 4115 | + | |
| 4116 | + | |
| 4117 | + | |
| 4118 | + | |
4097 | 4119 | | |
4098 | 4120 | | |
4099 | 4121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
| 544 | + | |
544 | 545 | | |
545 | 546 | | |
546 | 547 | | |
| |||
0 commit comments