]> git.baikalelectronics.ru Git - kernel.git/commit
spi: spi-ti-qspi: Handle truncated frames properly
authorBen Hutchings <ben.hutchings@codethink.co.uk>
Tue, 12 Apr 2016 11:58:14 +0000 (12:58 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 13 Apr 2016 07:12:41 +0000 (08:12 +0100)
commitd8577117071399d880893d423f9f95d8e188f0c1
treefd7a3c5af84df055ec34c5de017819d20f6b0b38
parent512818b4256bd80270d5afa196df2b6102cd333a
spi: spi-ti-qspi: Handle truncated frames properly

We clamp frame_len_words to a maximum of 4096, but do not actually
limit the number of words written or read through the DATA registers
or the length added to spi_message::actual_length.  This results in
silent data corruption for commands longer than this maximum.

Recalculate the length of each transfer, taking frame_len_words into
account.  Use this length in qspi_{read,write}_msg(), and to increment
spi_message::actual_length.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
drivers/spi/spi-ti-qspi.c