]> git.baikalelectronics.ru Git - kernel.git/commit
spi: Check presence the of ->transfer[_xxx]() before registering a controller
authorBoris Brezillon <boris.brezillon@bootlin.com>
Tue, 10 Apr 2018 22:44:30 +0000 (00:44 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 26 Apr 2018 12:53:29 +0000 (13:53 +0100)
commitcf0ea02c371b8eef7aebe0c6a2d711772072db65
tree908e4ca051d1936ec6dbdca0f300165cd061cfcc
parentd4058a88d962badff817cfbf05dc8de300755d60
spi: Check presence the of ->transfer[_xxx]() before registering a controller

Right now, no checks are done on the presence of a ->transfer[_xxx]()
method, which can lead to a NULL pointer dereference when someone
starts sending something on the bus.

Do the check at registration time and refuse to add the controller if
all ->transfer[_xxx]() pointers are NULL.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c