spi: Fix NULL pointer when setting SPI_CS_HIGH for GPIO CS
authorGregory CLEMENT <gregory.clement@bootlin.com>
Thu, 24 Oct 2019 14:13:09 +0000 (16:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Dec 2019 07:43:15 +0000 (08:43 +0100)
commit7008e30bf2a72087c949a083b0a9de4c2cbdf822
tree929c0f7370f0082aa1270958414492097ba0f5d1
parent39552e0e71c0109fd83284e28aaa5e8691a36fc9
spi: Fix NULL pointer when setting SPI_CS_HIGH for GPIO CS

commit 15f794bd977a0135328fbdd8a83cc64c1d267b39 upstream.

Even if the flag use_gpio_descriptors is set, it is possible that
cs_gpiods was not allocated, which leads to a kernel crash.

Reported-by: "kernelci.org bot" <bot@kernelci.org>
Fixes: 3e5ec1db8bfe ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS")
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20191024141309.22434-1-gregory.clement@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/spi/spi.c