Commit 378b295
spi: fix statistics allocation
commit dee0774 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 80f3e8c commit 378b295
1 file changed
+8
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2914 | 2914 | | |
2915 | 2915 | | |
2916 | 2916 | | |
| 2917 | + | |
| 2918 | + | |
2917 | 2919 | | |
2918 | 2920 | | |
2919 | 2921 | | |
| |||
3057 | 3059 | | |
3058 | 3060 | | |
3059 | 3061 | | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
| 3067 | + | |
3060 | 3068 | | |
3061 | 3069 | | |
3062 | 3070 | | |
| |||
3347 | 3355 | | |
3348 | 3356 | | |
3349 | 3357 | | |
3350 | | - | |
3351 | | - | |
3352 | | - | |
3353 | | - | |
3354 | | - | |
3355 | | - | |
3356 | | - | |
3357 | 3358 | | |
3358 | 3359 | | |
3359 | 3360 | | |
| |||
3366 | 3367 | | |
3367 | 3368 | | |
3368 | 3369 | | |
3369 | | - | |
3370 | | - | |
3371 | 3370 | | |
3372 | 3371 | | |
3373 | 3372 | | |
| |||
0 commit comments