mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 18:10:52 +07:00
spi: spidev: fix possible NULL dereference
During the last close we are freeing spidev if spidev->spi is NULL, but
just before checking if spidev->spi is NULL we are dereferencing it.
Lets add a check there to avoid the NULL dereference.
Fixes: 9169051617
("spi: spidev: Don't mangle max_speed_hz in underlying spi device")
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
bc0195aad0
commit
dd85ebf681
@ -651,7 +651,8 @@ static int spidev_release(struct inode *inode, struct file *filp)
|
||||
kfree(spidev->rx_buffer);
|
||||
spidev->rx_buffer = NULL;
|
||||
|
||||
spidev->speed_hz = spidev->spi->max_speed_hz;
|
||||
if (spidev->spi)
|
||||
spidev->speed_hz = spidev->spi->max_speed_hz;
|
||||
|
||||
/* ... after we unbound from the underlying device? */
|
||||
spin_lock_irq(&spidev->spi_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user