spi: fix use-after-free at controller deregistration
authorJohan Hovold <johan@kernel.org>
Mon, 30 Oct 2017 10:35:25 +0000 (11:35 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 31 Oct 2017 11:09:23 +0000 (11:09 +0000)
commit67f7b2781fafcc0f52464880154b320fea1ae982
tree4ecd11b1646048334b8aae7bc2a5acdb9d918b40
parent2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e
spi: fix use-after-free at controller deregistration

The controller is typically freed as part of device_unregister() so
store the bus id before deregistration to avoid use-after-free when the
id is later released.

Fixes: 9b61e302210e ("spi: Pick spi bus number from Linux idr or spi alias")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable <stable@vger.kernel.org>
drivers/spi/spi.c