diff options
author | 2020-04-09 10:18:10 +0300 | |
---|---|---|
committer | 2020-04-28 19:00:59 +0200 | |
commit | c3bf9930921b33edb31909006607e478751a6f5e (patch) | |
tree | 16e27b3fac5280ec7405c0a4a86f6be5edb72331 /drivers/thunderbolt | |
parent | Linux 5.7-rc3 (diff) | |
download | linux-c3bf9930921b33edb31909006607e478751a6f5e.tar.gz linux-c3bf9930921b33edb31909006607e478751a6f5e.tar.bz2 linux-c3bf9930921b33edb31909006607e478751a6f5e.zip |
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: b04079837b20 ("thunderbolt: Add initial support for USB4")
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Yehezkel Bernat <yehezkelshb@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/thunderbolt')
-rw-r--r-- | drivers/thunderbolt/usb4.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/thunderbolt/usb4.c b/drivers/thunderbolt/usb4.c index 3d084cec136f..50c7534ba31e 100644 --- a/drivers/thunderbolt/usb4.c +++ b/drivers/thunderbolt/usb4.c @@ -182,6 +182,9 @@ static int usb4_switch_op(struct tb_switch *sw, u16 opcode, u8 *status) return ret; ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_26, 1); + if (ret) + return ret; + if (val & ROUTER_CS_26_ONS) return -EOPNOTSUPP; |