]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: qlcnic: add missed unlock in qlcnic_83xx_flash_read32
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Mon, 16 Aug 2021 13:14:04 +0000 (21:14 +0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 17 Aug 2021 15:27:31 +0000 (08:27 -0700)
qlcnic_83xx_unlock_flash() is called on all paths after we call
qlcnic_83xx_lock_flash(), except for one error path on failure
of QLCRD32(), which may cause a deadlock. This bug is suggested
by a static analysis tool, please advise.

Fixes: 81d0aeb0a4fff ("qlcnic: flash template based firmware reset recovery")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Link: https://lore.kernel.org/r/20210816131405.24024-1-dinghao.liu@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c

index d8882d0b6b49834e46cbf40156ca0e2617d1c7af..d51bac7ba5afadca6df37a8761838432fba08b1f 100644 (file)
@@ -3156,8 +3156,10 @@ int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr,
 
                indirect_addr = QLC_83XX_FLASH_DIRECT_DATA(addr);
                ret = QLCRD32(adapter, indirect_addr, &err);
-               if (err == -EIO)
+               if (err == -EIO) {
+                       qlcnic_83xx_unlock_flash(adapter);
                        return err;
+               }
 
                word = ret;
                *(u32 *)p_data  = word;