Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'spi-fix-v6.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fix from Mark Brown:
"A fix adding missing validation that 8 bit I/O mode is actually
supported for the specific device when attempting to use it.

Anything that runs into this should already have been having problems,
enforcing this should just make things safer and more obvious"

* tag 'spi-fix-v6.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
spi: Add check for 8-bit transfer with 8 IO mode support

+10 -4
+10 -4
drivers/spi/spi.c
··· 4138 4138 xfer->tx_nbits != SPI_NBITS_OCTAL) 4139 4139 return -EINVAL; 4140 4140 if ((xfer->tx_nbits == SPI_NBITS_DUAL) && 4141 - !(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD))) 4141 + !(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL))) 4142 4142 return -EINVAL; 4143 4143 if ((xfer->tx_nbits == SPI_NBITS_QUAD) && 4144 - !(spi->mode & SPI_TX_QUAD)) 4144 + !(spi->mode & (SPI_TX_QUAD | SPI_TX_OCTAL))) 4145 + return -EINVAL; 4146 + if ((xfer->tx_nbits == SPI_NBITS_OCTAL) && 4147 + !(spi->mode & SPI_TX_OCTAL)) 4145 4148 return -EINVAL; 4146 4149 } 4147 4150 /* Check transfer rx_nbits */ ··· 4157 4154 xfer->rx_nbits != SPI_NBITS_OCTAL) 4158 4155 return -EINVAL; 4159 4156 if ((xfer->rx_nbits == SPI_NBITS_DUAL) && 4160 - !(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD))) 4157 + !(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL))) 4161 4158 return -EINVAL; 4162 4159 if ((xfer->rx_nbits == SPI_NBITS_QUAD) && 4163 - !(spi->mode & SPI_RX_QUAD)) 4160 + !(spi->mode & (SPI_RX_QUAD | SPI_RX_OCTAL))) 4161 + return -EINVAL; 4162 + if ((xfer->rx_nbits == SPI_NBITS_OCTAL) && 4163 + !(spi->mode & SPI_RX_OCTAL)) 4164 4164 return -EINVAL; 4165 4165 } 4166 4166