]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
spi: fix statistics allocation
authorJohan Hovold <johan@kernel.org>
Thu, 12 Mar 2026 15:18:14 +0000 (16:18 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 16 Mar 2026 18:36:03 +0000 (18:36 +0000)
commitdee0774bbb2abb172e9069ce5ffef579b12b3ae9
treec3335ab5ea51b8a1e7a13f9800252a09d03ba7a8
parent8634e05b08ead636e926022f4a98416e13440df9
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: 6598b91b5ac3 ("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>
drivers/spi/spi.c