linux/drivers/thunderbolt
Kees Cook 1981355170 thunderbolt: xdomain: Avoid potential stack OOB read
tb_xdp_properties_changed_request() was calling tb_xdp_handle_error() with
a struct tb_xdp_properties_changed_response on the stack, which does not
have the "error" field present when cast to struct tb_xdp_error_response.
This was detected when building with -Warray-bounds:

drivers/thunderbolt/xdomain.c: In function 'tb_xdomain_properties_changed':
drivers/thunderbolt/xdomain.c:226:22: error: array subscript 'const struct tb_xdp_error_response[0]' is partly outside array bounds of 'struct tb_xdp_properties_changed_response[1]' [-Werror=array-bounds]
  226 |         switch (error->error) {
      |                 ~~~~~^~~~~~~
drivers/thunderbolt/xdomain.c:448:51: note: while referencing 'res'
  448 |         struct tb_xdp_properties_changed_response res;
      |                                                   ^~~

Add union containing struct tb_xdp_error_response to structures passed
to tb_xdp_handle_error(), so that the "error" field will be present.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2021-12-07 15:05:44 +03:00
..
acpi.c thunderbolt: Add support for ACPI _DSM to power on/off retimers 2021-06-01 10:53:31 +03:00
cap.c thunderbolt: cap: Fix kernel-doc formatting issue 2021-01-28 12:33:18 +03:00
ctl.c thunderbolt: Enable retry logic for intra-domain control packets 2021-09-27 13:47:36 +03:00
ctl.h thunderbolt: Decrease control channel timeout for software connection manager 2021-03-18 18:25:30 +03:00
debugfs.c thunderbolt: debugfs: Show all accessible dwords 2021-03-12 13:13:34 +03:00
dma_port.c thunderbolt: Use generic tb_nvm_[read|write]_data() for Thunderbolt 2/3 devices 2021-05-31 14:37:54 +03:00
dma_port.h thunderbolt: Convert rest of the driver files to use SPDX identifier 2018-10-02 15:52:08 -07:00
dma_test.c thunderbolt: Allow multiple DMA tunnels over a single XDomain connection 2021-03-18 18:25:31 +03:00
domain.c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
eeprom.c thunderbolt: Fix DROM handling for USB4 DROM 2021-06-15 13:51:07 +03:00
icm.c thunderbolt: Add support for Intel Alder Lake 2021-06-11 11:42:54 +03:00
Kconfig thunderbolt: Add DMA traffic test driver 2020-11-11 10:20:16 +03:00
lc.c thunderbolt: Add wake from DisplayPort 2021-05-31 14:39:52 +03:00
Makefile thunderbolt: build kunit tests without structleak plugin 2021-10-06 17:53:49 -06: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 thunderbolt: Add support for Intel Ice Lake 2019-08-26 12:15:06 +03:00
nhi.c thunderbolt: Handle ring interrupt by reading interrupt status register 2021-08-09 14:58:29 +03:00
nhi.h thunderbolt: Add support for Intel Alder Lake 2021-06-11 11:42:54 +03:00
nvm.c thunderbolt: Split NVM read/write generic functions out from usb4.c 2021-05-31 14:37:48 +03:00
path.c thunderbolt: Move nfc_credits field to struct tb_path_hop 2021-06-01 10:48:59 +03:00
property.c thunderbolt: Add tb_property_copy_dir() 2021-03-18 18:25:31 +03:00
quirks.c thunderbolt: Add quirk for Intel Goshen Ridge DP credits 2021-06-01 10:48:59 +03:00
retimer.c thunderbolt: Check for NVM authentication status after the operation started 2021-06-01 10:53:32 +03:00
sb_regs.h thunderbolt: Add additional USB4 port operations for retimer access 2021-06-01 10:53:31 +03:00
switch.c thunderbolt: Changes for v5.15 merge window 2021-08-24 15:31:33 +02:00
tb_msgs.h thunderbolt: xdomain: Avoid potential stack OOB read 2021-12-07 15:05:44 +03:00
tb_regs.h thunderbolt: Read router preferred credit allocation information 2021-06-01 10:48:59 +03:00
tb.c thunderbolt: Add device links only when software connection manager is used 2021-06-11 11:42:54 +03:00
tb.h thunderbolt: Add WRITE_ONLY and AUTHENTICATE_ONLY NVM operations for retimers 2021-06-01 10:53:32 +03:00
test.c thunderbolt: test: split up test cases in tb_test_credit_alloc_all 2021-09-06 12:27:03 -07:00
tmu.c thunderbolt: Add support for Time Management Unit 2019-12-18 15:41:15 +01:00
tunnel.c thunderbolt: Allocate credits according to router preferences 2021-06-01 10:48:59 +03:00
tunnel.h thunderbolt: Allocate credits according to router preferences 2021-06-01 10:48:59 +03:00
usb4_port.c thunderbolt: No need to include <linux/acpi.h> in usb4_port.c 2021-06-11 11:42:54 +03:00
usb4.c thunderbolt: Add WRITE_ONLY and AUTHENTICATE_ONLY NVM operations for retimers 2021-06-01 10:53:32 +03:00
xdomain.c thunderbolt: xdomain: Avoid potential stack OOB read 2021-12-07 15:05:44 +03:00