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 E61DB1C5D72; Mon, 2 Jun 2025 14:31:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748874690; cv=none; b=JbYBUGstSTZvHRsQS1bpuBnot3Z1/WO76uXs0aDdPIX9kStCfAkVEuQRtJR03Qz7CciqrLoDn26wj+wseXilf+dMt8srB90QPnH3tKDuSUs71K/8rYjjG3j5+dq/utuwlPrbzvEiNkPjKEZ611PUVnXAchO1i80k3shcDq35j3Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748874690; c=relaxed/simple; bh=Oqgg0pvMFfx0WCSutj6aRLdzTGx/bbTavCk1wuaygCk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ufmkdUlKNbNPTF1g/6u4M5w+ieOQ/OXevwLU/Vj2xUss1raZ0C0rkabkoEu8I/n3J0iw/yfQ0pHERWQ/KrdN9DKnLJSNmar45i1Hg/xOimrpb70FFixBQ18xrRxPLgP+QdN4hE3DrID3go6YuDjno53OqAMYfJeC5PytPqLcK3g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nltHer67; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nltHer67" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54C9CC4CEEE; Mon, 2 Jun 2025 14:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748874689; bh=Oqgg0pvMFfx0WCSutj6aRLdzTGx/bbTavCk1wuaygCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nltHer67MD8N8+lVvdQXy9LSmqafFEkhULixUl4Csrnn2Owmm9F4rJdRl3VjJtwdq 8sg5qITKbpa0xR0kwHA9Y7c+jGU66kvqCErC9SqHHJYV0sa8cwVh8HDHCGXe3ipNre 4xeWv1WBCgqAysZ0hc9xrdoAWL7PZSHGKpo9zDU8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abdun Nihaal , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 074/204] qlcnic: fix memory leak in qlcnic_sriov_channel_cfg_cmd() Date: Mon, 2 Jun 2025 15:46:47 +0200 Message-ID: <20250602134258.587431767@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134255.449974357@linuxfoundation.org> References: <20250602134255.449974357@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abdun Nihaal [ Upstream commit 9d8a99c5a7c7f4f7eca2c168a4ec254409670035 ] In one of the error paths in qlcnic_sriov_channel_cfg_cmd(), the memory allocated in qlcnic_sriov_alloc_bc_mbx_args() for mailbox arguments is not freed. Fix that by jumping to the error path that frees them, by calling qlcnic_free_mbx_args(). This was found using static analysis. Fixes: f197a7aa6288 ("qlcnic: VF-PF communication channel implementation") Signed-off-by: Abdun Nihaal Reviewed-by: Simon Horman Link: https://patch.msgid.link/20250512044829.36400-1-abdun.nihaal@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index 5d8b9e10ddf84..d6fcef1651a7e 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c @@ -1486,8 +1486,11 @@ static int qlcnic_sriov_channel_cfg_cmd(struct qlcnic_adapter *adapter, u8 cmd_o } cmd_op = (cmd.rsp.arg[0] & 0xff); - if (cmd.rsp.arg[0] >> 25 == 2) - return 2; + if (cmd.rsp.arg[0] >> 25 == 2) { + ret = 2; + goto out; + } + if (cmd_op == QLCNIC_BC_CMD_CHANNEL_INIT) set_bit(QLC_BC_VF_STATE, &vf->state); else -- 2.39.5