Skip to content

Commit c3bf993

Browse files
westerigregkh
authored andcommitted
thunderbolt: Check return value of tb_sw_read() in usb4_switch_op()
The function misses checking return value of tb_sw_read() before it accesses the value that was read. Fix this by checking the return value first. Fixes: b040798 ("thunderbolt: Add initial support for USB4") Signed-off-by: Mika Westerberg <[email protected]> Reviewed-by: Yehezkel Bernat <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6a8b55e commit c3bf993

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/thunderbolt/usb4.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ static int usb4_switch_op(struct tb_switch *sw, u16 opcode, u8 *status)
182182
return ret;
183183

184184
ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_26, 1);
185+
if (ret)
186+
return ret;
187+
185188
if (val & ROUTER_CS_26_ONS)
186189
return -EOPNOTSUPP;
187190

0 commit comments

Comments
 (0)