Commit dee0774
spi: fix statistics allocation
The controller per-cpu statistics is not allocated until after the
controller has been registered with driver core, which leaves a window
where accessing the sysfs attributes can trigger a NULL-pointer
dereference.
Fix this by moving the statistics allocation to controller allocation
while tying its lifetime to that of the controller (rather than using
implicit devres).
Fixes: 6598b91 ("spi: spi.c: Convert statistics to per-cpu u64_stats_t")
Cc: stable@vger.kernel.org # 6.0
Cc: David Jander <david@protonic.nl>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260312151817.32100-3-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>1 parent 8634e05 commit dee0774
1 file changed
Lines changed: 8 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3049 | 3049 | | |
3050 | 3050 | | |
3051 | 3051 | | |
| 3052 | + | |
| 3053 | + | |
3052 | 3054 | | |
3053 | 3055 | | |
3054 | 3056 | | |
| |||
3192 | 3194 | | |
3193 | 3195 | | |
3194 | 3196 | | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
3195 | 3203 | | |
3196 | 3204 | | |
3197 | 3205 | | |
| |||
3483 | 3491 | | |
3484 | 3492 | | |
3485 | 3493 | | |
3486 | | - | |
3487 | | - | |
3488 | | - | |
3489 | | - | |
3490 | | - | |
3491 | | - | |
3492 | | - | |
3493 | 3494 | | |
3494 | 3495 | | |
3495 | 3496 | | |
| |||
3502 | 3503 | | |
3503 | 3504 | | |
3504 | 3505 | | |
3505 | | - | |
3506 | | - | |
3507 | 3506 | | |
3508 | 3507 | | |
3509 | 3508 | | |
| |||
0 commit comments