linux-brain/drivers/thunderbolt
Mathias Nyman eb78fa5a38 thunderbolt: dma_port: Fix NVM read buffer bounds and offset issue
commit b106776080a1cf953a1b2fd50cb2a995db4732be upstream.

Up to 64 bytes of data can be read from NVM in one go. Read address
must be dword aligned. Data is read into a local buffer.

If caller asks to read data starting at an unaligned address then full
dword is anyway read from NVM into a local buffer. Data is then copied
from the local buffer starting at the unaligned offset to the caller
buffer.

In cases where asked data length + unaligned offset is over 64 bytes
we need to make sure we don't read past the 64 bytes in the local
buffer when copying to caller buffer, and make sure that we don't
skip copying unaligned offset bytes from local buffer anymore after
the first round of 64 byte NVM data read.

Fixes: 3e13676862 ("thunderbolt: Add support for DMA configuration based mailbox")
Cc: stable@vger.kernel.org
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-03 08:59:03 +02:00
..
Kconfig
Makefile
cap.c
ctl.c
ctl.h
dma_port.c thunderbolt: dma_port: Fix NVM read buffer bounds and offset issue 2021-06-03 08:59:03 +02:00
dma_port.h
domain.c
eeprom.c
icm.c thunderbolt: Fix use-after-free in remove_unplugged_switch() 2020-12-11 13:23:29 +01:00
lc.c
nhi.c thunderbolt: Add the missed ida_simple_remove() in ring_request_msix() 2020-11-18 19:20:29 +01:00
nhi.h
nhi_ops.c
nhi_regs.h
path.c
property.c
switch.c
tb.c
tb.h
tb_msgs.h
tb_regs.h
tunnel.c
tunnel.h
xdomain.c