All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: qlcnic: add missed unlock in qlcnic_83xx_flash_read32
@ 2021-08-16 13:14 Dinghao Liu
  2021-08-17 15:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2021-08-16 13:14 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Shahed Shaikh, Manish Chopra, GR-Linux-NIC-Dev, David S. Miller,
	Jakub Kicinski, Sony Chacko, netdev, linux-kernel

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>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index d8882d0b6b49..d51bac7ba5af 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: qlcnic: add missed unlock in qlcnic_83xx_flash_read32
  2021-08-16 13:14 [PATCH] net: qlcnic: add missed unlock in qlcnic_83xx_flash_read32 Dinghao Liu
@ 2021-08-17 15:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-17 15:30 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: kjlu, shshaikh, manishc, GR-Linux-NIC-Dev, davem, kuba,
	sony.chacko, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Mon, 16 Aug 2021 21:14:04 +0800 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - net: qlcnic: add missed unlock in qlcnic_83xx_flash_read32
    https://git.kernel.org/netdev/net/c/0a298d133893

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-17 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 13:14 [PATCH] net: qlcnic: add missed unlock in qlcnic_83xx_flash_read32 Dinghao Liu
2021-08-17 15:30 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.