Skip to content

Commit 6b35b17

Browse files
Bartosz Golaszewskibroonie
authored andcommitted
spi: spidev: remove debug messages that access spidev->spi without locking
The two debug messages in spidev_open() dereference spidev->spi without taking the lock and without checking if it's not null. This can lead to a crash. Drop the messages as they're not needed - the user-space will get informed about ENOMEM with the syscall return value. Signed-off-by: Bartosz Golaszewski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent a720416 commit 6b35b17

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

drivers/spi/spidev.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,6 @@ static int spidev_open(struct inode *inode, struct file *filp)
603603
if (!spidev->tx_buffer) {
604604
spidev->tx_buffer = kmalloc(bufsiz, GFP_KERNEL);
605605
if (!spidev->tx_buffer) {
606-
dev_dbg(&spidev->spi->dev, "open/ENOMEM\n");
607606
status = -ENOMEM;
608607
goto err_find_dev;
609608
}
@@ -612,7 +611,6 @@ static int spidev_open(struct inode *inode, struct file *filp)
612611
if (!spidev->rx_buffer) {
613612
spidev->rx_buffer = kmalloc(bufsiz, GFP_KERNEL);
614613
if (!spidev->rx_buffer) {
615-
dev_dbg(&spidev->spi->dev, "open/ENOMEM\n");
616614
status = -ENOMEM;
617615
goto err_alloc_rx_buf;
618616
}

0 commit comments

Comments
 (0)