Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2902355pxb; Tue, 24 Aug 2021 10:13:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbtC+Fo1eM0tLNx9HIq8R7Lyl7Zz/s0/FQOu1TFklsYJ3+A68i7u7supr8htlbC3c1MVDO X-Received: by 2002:a05:6638:81:: with SMTP id v1mr22241417jao.11.1629825190583; Tue, 24 Aug 2021 10:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629825190; cv=none; d=google.com; s=arc-20160816; b=Wl/70GT/jEHGYjNiB2HbewU5VS/zEZs4X0REn7Ojpl8m7W6DbbPny9XcVvZsXy1FqH DFDdxZQPytWV1ZZvFGHLzVtRwUGAUclP5vFK15J8zqcAhRzuhtKusS11fIqVI49Nssm1 tqZ23Tvsa9ELQjj6CBQ4wn5fvFxAyEgGKG+Fay9FZP/NTsf5gqyf+X266610+Li8EaZY 2pNru18YtffP0wVdAi6TKGISX+N0M7/nJIVn0FiY0Jy+/qst9kkFx5H6v7G5v3TSDiBR 0MPfwnjQgRI5lGUL5V4g1rOvk6dBlh7/iCkxoz+KPrU0LmO1grmb2H11tDBPaY3bSex6 bGnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=B+TiiOUiNKrFF7QI8vOV6GNangTGwlOm5JgEWczbVnw=; b=MV7jyJb3WMeU50dFPVGSXc4nAT8fSfuS0ZD1xb0owmu/swiMaS2hpSNeDMgvhvpvJ0 TSBXjSRRXFTcwSw4jZxNcsBVJp8qwpcs2uzvAAECHYBY64iReI9tUYoRzWRszgLqz6FI VNbcyObZ3dU2l46Qb3iGXfWLrZ/aKZjaAilaYoJkjOL5WRt/ZmfhYxw3y4khwaSbPzLu 58bBhHUvMzJag9eRU5ZKgkkCKwB6rmAJfMNUzgWQixknTalRJ1o2SNyunx9YkHfZOkT4 y/D1nv2oTm6IIDaAr/JN0AfvBzFI7see2HrrVwSZa7L8BKNv4YjelnotJiXcDzZFZBOZ 60Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q2w8CO0G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z22si17800710jaq.37.2021.08.24.10.12.58; Tue, 24 Aug 2021 10:13:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q2w8CO0G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239080AbhHXRLn (ORCPT + 99 others); Tue, 24 Aug 2021 13:11:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:51788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239165AbhHXRIs (ORCPT ); Tue, 24 Aug 2021 13:08:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E2663613DB; Tue, 24 Aug 2021 17:00:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824409; bh=10ppWwsutgLxe02LhILcoq5ChQZYGwDKTujjCSNGd5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q2w8CO0Gk1c4y0uB7fqFvwpWhRyGM0ehMWW90i9LLR5luS3fT+9ID/D1W7CrZwdgG iXf1oPO6HZoC4GOPoXJUbLCzz6ZcbbIEbMDP1KEakv6MALUMPPJC92QZHJ7igXrZkH 0vrmouN9QjIpOTgu7f8vttHAbcWwJ/Db9hoa9hyQE9CCa/pxWLhWfKLgyt/gCGc3fU nLJLL78jC9Nnddz3CTpFBk0NM3cPjOulICNkbbx+qp5K5Yn+mjtrQsGMR4sishBPyQ ZhlqIFzj7LIsGMvv7Ob73jEA6vazm3ZK22fejxNS23yl7HMznz4tjBqkTY0++CxfwD CFfp0a+hsXDUw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dinghao Liu , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 60/98] net: qlcnic: add missed unlock in qlcnic_83xx_flash_read32 Date: Tue, 24 Aug 2021 12:58:30 -0400 Message-Id: <20210824165908.709932-61-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165908.709932-1-sashal@kernel.org> References: <20210824165908.709932-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.61-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.10.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.10.61-rc1 X-KernelTest-Deadline: 2021-08-26T16:58+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dinghao Liu [ Upstream commit 0a298d133893c72c96e2156ed7cb0f0c4a306a3e ] 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 Link: https://lore.kernel.org/r/20210816131405.24024-1-dinghao.liu@zju.edu.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- 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.30.2