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 34DD01FF61E; Mon, 2 Jun 2025 14:43:51 +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=1748875431; cv=none; b=jsk3Ec72EL6C4ychimfxQiEWSuM7kQnpd0gRa9YnFsohQCrRfaBmtr4m2kaZRTdfIYn6Gj49nHAtjh0xzHyFNaVCf6lgKCL6LWIGW1pHEX4UjqJevztVb/4E/dQUqa7Nc1/a08+QB+9F8NBHFJmEbc0sdF169sqGIYuj6EdKudE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748875431; c=relaxed/simple; bh=jaGw6YVFG2zSVr6oYN8M453B3uWhWuOZ03MOu+bc3yw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DJz5C6yuhL/QqPT5C5gabJZD5pzW06oEePc/3w0rUMnxCGaHrIqq+5KL7SwifJb+BqKaBZ6dw0sUaiSrTy/2hp4veKYPzhhiBP/owmk1yRL/Uk2WX/BptguOkSOj60TovnPkZcMeScqMkw7teBG5Y6f4bGlx8q6/BD1il8cH91w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Wh6dyfRO; 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="Wh6dyfRO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 975FDC4CEEB; Mon, 2 Jun 2025 14:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748875431; bh=jaGw6YVFG2zSVr6oYN8M453B3uWhWuOZ03MOu+bc3yw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wh6dyfROH2YZsPayac0vkFDeGwaGCgsGBrM4FB16DP0fPnaQ/GKJa82xlwV30hlDH q19WuSBnPKsxxiaPNGC4voi80eS/8gXY0van+ZNGERaz8lqx1Gg5ICFgtQELw/sOwb 0noVmTw4GrjUFMKRbAWJMCnRG4BKTRSoTbMtu1tM= 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.10 093/270] qlcnic: fix memory leak in qlcnic_sriov_channel_cfg_cmd() Date: Mon, 2 Jun 2025 15:46:18 +0200 Message-ID: <20250602134310.981921955@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134307.195171844@linuxfoundation.org> References: <20250602134307.195171844@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.10-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 256b19f68caed..bf510d3882cf1 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c @@ -1485,8 +1485,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