linux-stable/drivers/thunderbolt
Mathias Nyman 439a0b07fd thunderbolt: dma_port: Fix NVM read buffer bounds and offset issue
commit b106776080 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 09:00:32 +02:00
..
acpi.c thunderbolt: Fix possible NULL pointer dereference in tb_acpi_add_link() 2021-02-10 09:29:15 +01:00
cap.c thunderbolt: Introduce tb_switch_next_cap() 2020-09-03 12:21:07 +03:00
ctl.c thunderbolt: Log correct zeroX entries in decode_error() 2020-09-16 14:57:46 +03:00
ctl.h thunderbolt: Populate PG field in hot plug acknowledgment packet 2019-12-18 15:34:25 +01:00
debugfs.c thunderbolt: Add uaccess dependency to debugfs interface 2020-11-05 13:32:46 +03:00
dma_port.c thunderbolt: dma_port: Fix NVM read buffer bounds and offset issue 2021-06-03 09:00:32 +02:00
dma_port.h
domain.c thunderbolt: Allow KUnit tests to be built also when CONFIG_USB4=m 2020-09-16 14:57:46 +03:00
eeprom.c thunderbolt: Retry DROM read once if parsing fails 2020-09-09 14:00:56 +03:00
icm.c thunderbolt: Fix use-after-free in remove_unplugged_switch() 2020-11-19 17:44:10 +03:00
Kconfig thunderbolt: Use "if USB4" instead of "depends on" in Kconfig 2020-09-16 14:57:46 +03:00
lc.c thunderbolt: Enable wakes from system suspend 2020-09-03 12:06:42 +03:00
Makefile thunderbolt: Allow KUnit tests to be built also when CONFIG_USB4=m 2020-09-16 14:57:46 +03:00
nhi.c thunderbolt: Add support for Intel Tiger Lake-H 2020-11-06 16:39:11 +03:00
nhi.h thunderbolt: Add support for Intel Tiger Lake-H 2020-11-06 16:39:11 +03:00
nhi_ops.c thunderbolt: Software CM only should set force power in Tiger Lake 2020-09-03 12:06:40 +03:00
nhi_regs.h
nvm.c thunderbolt: Add support for separating the flush to SPI and authenticate 2020-07-01 13:51:49 +03:00
path.c thunderbolt: Add USB3 bandwidth management 2020-06-22 19:58:20 +03:00
property.c
quirks.c thunderbolt: Correct tb_check_quirks() kernel-doc 2020-09-16 14:57:46 +03:00
retimer.c thunderbolt: Fix off by one in tb_port_find_retimer() 2021-04-14 08:42:03 +02:00
sb_regs.h thunderbolt: Add support for on-board retimers 2020-06-22 19:58:32 +03:00
switch.c thunderbolt: Initialize HopID IDAs in tb_switch_alloc() 2021-03-25 09:04:15 +01:00
tb.c thunderbolt: Increase runtime PM reference count on DP tunnel discovery 2021-03-25 09:04:15 +01:00
tb.h thunderbolt: Add support for Intel Tiger Lake-H 2020-11-06 16:39:11 +03:00
tb_msgs.h thunderbolt: Handle ERR_LOCK notification 2020-09-16 14:57:46 +03:00
tb_regs.h thunderbolt: Add debugfs interface 2020-09-03 12:21:08 +03:00
test.c thunderbolt: Allow KUnit tests to be built also when CONFIG_USB4=m 2020-09-16 14:57:46 +03:00
tmu.c thunderbolt: Add support for Time Management Unit 2019-12-18 15:41:15 +01:00
tunnel.c thunderbolt: Fixes for v5.9-rc4 2020-09-01 09:48:28 +02:00
tunnel.h thunderbolt: Add USB3 bandwidth management 2020-06-22 19:58:20 +03:00
usb4.c thunderbolt: usb4: Fix NVM read buffer bounds and offset issue 2021-06-03 09:00:32 +02:00
xdomain.c thunderbolt: Fix memory leak if ida_simple_get() fails in enumerate_services() 2020-11-05 13:32:40 +03:00