From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 E4BEE331220; Wed, 20 May 2026 17:18:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779297496; cv=none; b=V7BmkcptZmzlEKe+5LpBONd7Spjy8IgLEHmbpEJ5dtcJMriRbNi4nStDMLSEtg1c58yFeilAq/vaaZOctp8r4BPgfbnPN/ShzKKZ2kuTQPS0UW+3K/I2ScE14g9K9AYR9wmxLQd0brUhnQTk0hY7b4J5IiyJKF/7Yk/z+SDvZ8s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779297496; c=relaxed/simple; bh=Fw0/eWPd+8kYfVW8aIeh+l3sQROjqjMsugEoXJRv/8Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D10fkQpMqpEXdw/1ZuPwN+5Qpx0n7WxWRzEVMKouPAW7oG67c+XKkUZiggP7V6O2iQCkgy8petnN4Sw/AtAnUrLVLbB1luPz8FCXGaP8qhKtv9SjS1JL3OvKSO1q7//WPDwgS3QaXEFUMeU+mMnKBYBcAQm215BebMG32bcd17s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fpmgLlaP; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fpmgLlaP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 215521F000E9; Wed, 20 May 2026 17:18:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779297494; bh=WqbBA2n0T4KEisO8gmeXEdw2SJRIDC/J2j18vXWiVvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fpmgLlaPq6WibMz6xp5C7sBMGOMiDc3aJbrkSGvb+0kkDffRhMKeUi5DRPVFxcGFj HPAEW1OdW5OdDOhrZwwcQNjuf6aNqoas49kl5eJ8kQO/VSoRP7WHnYjytK/llK9Hjh XUWjKgbWsTIK7Duadb0zmCw4rd+SFlfbV4UoM+ac= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zilin Guan , Jeff Chen , Johannes Berg , Sasha Levin Subject: [PATCH 6.18 054/957] wifi: mwifiex: Fix memory leak in mwifiex_11n_aggregate_pkt() Date: Wed, 20 May 2026 18:08:57 +0200 Message-ID: <20260520162135.731122588@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@linuxfoundation.org> User-Agent: quilt/0.69 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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zilin Guan [ Upstream commit 990a73dec3fdc145fef6c827c29205437d533ece ] In mwifiex_11n_aggregate_pkt(), skb_aggr is allocated via mwifiex_alloc_dma_align_buf(). If mwifiex_is_ralist_valid() returns false, the function currently returns -1 immediately without freeing the previously allocated skb_aggr, causing a memory leak. Since skb_aggr has not yet been queued via skb_queue_tail(), no other references to this memory exist. Therefore, it has to be freed locally before returning the error. Fix this by calling mwifiex_write_data_complete() to free skb_aggr before returning the error status. Compile tested only. Issue found using a prototype static analysis tool and code review. Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver") Signed-off-by: Zilin Guan Reviewed-by: Jeff Chen Link: https://patch.msgid.link/20260119092625.1349934-1-zilin@seu.edu.cn Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/mwifiex/11n_aggr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c index 34b4b34276d6d..042b1fe5f0d67 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c @@ -203,6 +203,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, if (!mwifiex_is_ralist_valid(priv, pra_list, ptrindex)) { spin_unlock_bh(&priv->wmm.ra_list_spinlock); + mwifiex_write_data_complete(adapter, skb_aggr, 1, -1); return -1; } -- 2.53.0