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 1B21621E0BB; Tue, 20 May 2025 14:03:31 +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=1747749811; cv=none; b=W2G7Raj3HWPTpOpgG8SqCvAVOwO7u+RzBOXiqDzHTfyQHdSUQ2rdQUn1oD6GU7P6KXYotxrnseQAuQ9CK3E8rbrb3XnvoSIb7B4htWbjHRkukBFYLuyZTnJb3kAl23P6eCNLCMYKmLTDieG82dREH54/ogfBtrg8G9Ps1OFenhk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747749811; c=relaxed/simple; bh=axR3kXiBTpYxTfuT9Wcm6wIi/6aERCuXTsYEHjnIbiE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pDOzs76ukll/Z+uuyz9kwZLG3RT43ndRs/2Z+VrsArxot5pAw8ihrNw7ettmaiK9Ql3JNGe3CEkTcYV+k2K1izmJoCJG7PCaQLcXXHCto3OHmXBeL4MX5tjNJnzjeKRIyWhbk9cQd+yav7o3iVW2u5rl0K9J7cVSJb/a65J4FtM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2AF7g6lv; 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="2AF7g6lv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9618DC4CEE9; Tue, 20 May 2025 14:03:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1747749810; bh=axR3kXiBTpYxTfuT9Wcm6wIi/6aERCuXTsYEHjnIbiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2AF7g6lvbwqcfuMh/poVOiCB8gvMzvYrB7gBIDQItvYfL2R1HNYJBlT4MOiC342eR T+bqX5oxbMB5d52BKTIXCmdo7mVcrodeKdi9Ys1S6crMqx6vDoOH/lvzsPu9xzCd0S iWx6+Q8Niqd0zjXpqII+OIb/JEXmn6DGpglYGNhU= 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 6.6 050/117] qlcnic: fix memory leak in qlcnic_sriov_channel_cfg_cmd() Date: Tue, 20 May 2025 15:50:15 +0200 Message-ID: <20250520125805.976812224@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250520125803.981048184@linuxfoundation.org> References: <20250520125803.981048184@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 6.6-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 28d24d59efb84..d57b976b90409 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c @@ -1484,8 +1484,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