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 4EC02BA45 for ; Tue, 7 Mar 2023 18:03:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9A8EC433D2; Tue, 7 Mar 2023 18:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678212238; bh=TjJOiZI3jDkhq6je2d/SoQI4Ey7mhrFqitTJvH+zlaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=urhHvWbES041lbk+JbK1MFtENa69yTz8RiC3TZWcKn9KkZnwQJNNeZpM/IRWyK1eR Gc0MHQlNyiGSmfylNwsVyc45xBgdDKbxPjdRD23yN97uIi7/+TkBek04EKwyBsQzdJ lvqYuulBnzakRx27dpc1GPIlcAr32f1yPlKyrd7I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhengchao Shao , Jiri Pirko , Kalle Valo , Sasha Levin Subject: [PATCH 6.1 122/885] wifi: libertas: fix memory leak in lbs_init_adapter() Date: Tue, 7 Mar 2023 17:50:56 +0100 Message-Id: <20230307170007.152932917@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307170001.594919529@linuxfoundation.org> References: <20230307170001.594919529@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: Zhengchao Shao [ Upstream commit 16a03958618fb91bb1bc7077cf3211055162cc2f ] When kfifo_alloc() failed in lbs_init_adapter(), cmd buffer is not released. Add free memory to processing error path. Fixes: 7919b89c8276 ("libertas: convert libertas driver to use an event/cmdresp queue") Signed-off-by: Zhengchao Shao Reviewed-by: Jiri Pirko Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20221208121448.2845986-1-shaozhengchao@huawei.com Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/libertas/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/marvell/libertas/main.c b/drivers/net/wireless/marvell/libertas/main.c index 8f5220cee1123..ae975304cfcfa 100644 --- a/drivers/net/wireless/marvell/libertas/main.c +++ b/drivers/net/wireless/marvell/libertas/main.c @@ -869,6 +869,7 @@ static int lbs_init_adapter(struct lbs_private *priv) ret = kfifo_alloc(&priv->event_fifo, sizeof(u32) * 16, GFP_KERNEL); if (ret) { pr_err("Out of memory allocating event FIFO buffer\n"); + lbs_free_cmd_buffer(priv); goto out; } -- 2.39.2