Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3984839pxb; Mon, 4 Oct 2021 14:26:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcP2IRy2zJc340fHiJ7vjZij0CDYV4otluGqstJZzQhegAdKGE53qQgF7qwWr3S6sRUkys X-Received: by 2002:a50:fc86:: with SMTP id f6mr3218544edq.283.1633382788098; Mon, 04 Oct 2021 14:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633382788; cv=none; d=google.com; s=arc-20160816; b=kbfUWwB066VGRzMCFoGGXRGiQQEvOdfNYt0Q/PMtrxgUKyYdiQna/Lcv+99uoZSHS6 Lu3Og7r0WsXV2rltIYooazUwrKmSf4o7W8wNo3Vz7faH9cIB+w2UHHN9rxtg/CGVwhe5 xNl5593Qze/bPDqzFamoqWvqfTLlgyPX3fa/7Rc1H5+oz5CQ3zViFxoUj4GpG76p282P v3fR0vePE1xDiMf1SD88CGB/dPZ1K/TZEu01SaxTHkPTz4LW5OXG86TOees+0ITeIge/ Ra6q80Jv/D3PdVokzUsqgjfhwEDnHW6iACXrJl8diQVxAQtsRMXf1EDQqfvmnJu0cdjc D9oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PkurSJWO5m6RnLIJ1DJweePpjXrVjY17UrTM5SxmcXk=; b=XyAmd+4De0wpTSOHwb8PuzAkdpU2xrOxuAK6kG2Tdc4MTt2gtHeQKbVcI7D7ZwhX/n zbuIqB42QkH/msMqxQLngdQcnENaKwywVPJRv2RVnbcEs8D180x8MOBn6aaK0o60EnqP Ky8g2dwSen2MiUzgYv1AJ3gTKm83lzo1jtBfX2vMSUDxo9q+2xEftqe0z5WP4YhKZ1pX J9LHeWJYDgetIQ+iakloOct9+2y9NClFXsKqJ2O3SaM3J8bT7hFWgHnm2wlAiqkgmYIG MKVq260UdlKHstETOLxVBT/lypib4vhZk9jjTV5i++97thjxgBAn286XPbyEYCqTD2S7 YblA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tw00qvuh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si18902943ejk.388.2021.10.04.14.25.56; Mon, 04 Oct 2021 14:26:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tw00qvuh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237689AbhJDNgm (ORCPT + 99 others); Mon, 4 Oct 2021 09:36:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:47096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237787AbhJDNe5 (ORCPT ); Mon, 4 Oct 2021 09:34:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 23F9A61B45; Mon, 4 Oct 2021 13:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633353340; bh=7SnyddLCr/GWPeUpFNCi4ClkEwx3EauQ2ygNGZESIIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tw00qvuhbbJn32POOZRyZhXM7G63TuoHFTVn+5cYBlBOFnMa4UsGR0kQtcXfBJst4 t9zN4nsHSP0xvtpOsQ3RqHgnE3IxsMUD22QsYridUwUPTZb+LLoPkhpa5q8SiosEgv QasetHa9DqjFT8bX1POOZLuoXYDVniz/3kqvLqBg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chih-Kang Chang , Zong-Zhe Yang , Ping-Ke Shih , Johannes Berg , Sasha Levin Subject: [PATCH 5.14 089/172] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug Date: Mon, 4 Oct 2021 14:52:19 +0200 Message-Id: <20211004125047.870621326@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125044.945314266@linuxfoundation.org> References: <20211004125044.945314266@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chih-Kang Chang [ Upstream commit fe94bac626d9c1c5bc98ab32707be8a9d7f8adba ] In ieee80211_amsdu_aggregate() set a pointer frag_tail point to the end of skb_shinfo(head)->frag_list, and use it to bind other skb in the end of this function. But when execute ieee80211_amsdu_aggregate() ->ieee80211_amsdu_realloc_pad()->pskb_expand_head(), the address of skb_shinfo(head)->frag_list will be changed. However, the ieee80211_amsdu_aggregate() not update frag_tail after call pskb_expand_head(). That will cause the second skb can't bind to the head skb appropriately.So we update the address of frag_tail to fix it. Fixes: 6e0456b54545 ("mac80211: add A-MSDU tx support") Signed-off-by: Chih-Kang Chang Signed-off-by: Zong-Zhe Yang Signed-off-by: Ping-Ke Shih Link: https://lore.kernel.org/r/20210830073240.12736-1-pkshih@realtek.com [reword comment] Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/tx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index fa09a369214d..0208f68af394 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3380,6 +3380,14 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head)) goto out; + /* If n == 2, the "while (*frag_tail)" loop above didn't execute + * and frag_tail should be &skb_shinfo(head)->frag_list. + * However, ieee80211_amsdu_prepare_head() can reallocate it. + * Reload frag_tail to have it pointing to the correct place. + */ + if (n == 2) + frag_tail = &skb_shinfo(head)->frag_list; + /* * Pad out the previous subframe to a multiple of 4 by adding the * padding to the next one, that's being added. Note that head->len -- 2.33.0