From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89684749D for ; Thu, 12 Jan 2023 14:11:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C94D9C433F0; Thu, 12 Jan 2023 14:11:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673532711; bh=N33rmCxZvLDR8x+IZHMxTV6ecmdwHFbUyYeXdOBtkZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FzqTqW3hiHi8x0yeczwSOdI5fKXWZUFIJ1CuexC0GsHEbR77wnKr/sZuydZAv1RI8 V4TJiE7pr4qO0dTaIMd4eo0rgD8J6Xb+nSRemUgyHAMu/Nmi/KrO6pNKhIUYWFMus9 3yBAPE8Ig7Ju0Hg8LlB9pNd1Bf13zXnDDBtkXLfU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yuan Can , Leon Romanovsky , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 252/783] drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init() Date: Thu, 12 Jan 2023 14:49:28 +0100 Message-Id: <20230112135536.071616398@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230112135524.143670746@linuxfoundation.org> References: <20230112135524.143670746@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Yuan Can [ Upstream commit 01de1123322e4fe1bbd0fcdf0982511b55519c03 ] If vp alloc failed in qlcnic_sriov_init(), all previously allocated vp needs to be freed. Fixes: f197a7aa6288 ("qlcnic: VF-PF communication channel implementation") Signed-off-by: Yuan Can Reviewed-by: Leon Romanovsky Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index 8367891bfb13..e864c453c5e6 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c @@ -221,6 +221,8 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs) return 0; qlcnic_destroy_async_wq: + while (i--) + kfree(sriov->vf_info[i].vp); destroy_workqueue(bc->bc_async_wq); qlcnic_destroy_trans_wq: -- 2.35.1