Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3733222pxb; Mon, 4 Oct 2021 08:28:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9zV3xwABmfl32LvNfp55h62f467ys5cGdppXRPTTTQl1ShAUeI7nLkicTcrFCK82S1j71 X-Received: by 2002:a63:7:: with SMTP id 7mr11466237pga.127.1633361299440; Mon, 04 Oct 2021 08:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633361299; cv=none; d=google.com; s=arc-20160816; b=XeHXJxp24m0NdZlzitZGRzGlZ0FCZS+NG2TA8IxJPZ8FvVM61WiwDcjVubDYU39lkY RriPZrSwlVIoH8NgWp7r73FX3iZdFJR6zdPiHNtN0qHdy7lQvMTQ/qcFwUwkYa0nuyNq LJZj9fg/0HIqZ6I7mV0wUrfrMC3aom2eebK8DLZG6p4rKxgVdptswenK8mqkw2LQTpDi rWSXPzESf0pQBpduMLpZPbuYjqiGWpLcbYhoEMlcMZC6bpMdegEwitHQSCxiO3fGuPbM FsrffLImv9scYe9Ne9/2Dxngd0yB46HNHvbBMeCVa4PJZjo6Ydq3ZSUiFEEAFLO5qIL9 jADA== 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=XA0hM5tzs71Bb5WvEVFbYlxQ2NNJJagcUVPI1zv80GA=; b=Qz5BOCIm4Vwf3xIQHSSIgeN4SMaOqzs94DLhJ92B1Lz7qd7+cOjXfIB6UveHi9YP0l Tj5wlALoFFUv5CBw5S9StNbxQ3UYzyd0LOyQ7jBWFOIpvUVoAAtsfMeoDx99YHKNS1SG cxlip3WODQtMZt+NyPWCMDOjvKhsvqLN22U9t+Rm0sdn2U+CX5MTw7UpExbYbdKuKvHz Js4WWwezTf93jXgDwDsPBo65OKxyTvSFxFJBMU0xMGuOshiaNhkqiN13zhIAK+p3H6ri bdJ371YhEubwQbC2/k6XkSjs/FCEGCLedFV97iEom6SaiNHQcA6tELpqM5ZPJUeVwIb4 nQWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MUAWf7MT; 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 j4si19210855pjv.119.2021.10.04.08.28.05; Mon, 04 Oct 2021 08:28:19 -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=MUAWf7MT; 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 S236050AbhJDNPe (ORCPT + 99 others); Mon, 4 Oct 2021 09:15:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:47450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236194AbhJDNNd (ORCPT ); Mon, 4 Oct 2021 09:13:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 84B3461B96; Mon, 4 Oct 2021 13:05:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633352724; bh=a2+kG5sFOBIYP9dp9OMr88Vdq/6u3z9eqdVqNmIRAYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MUAWf7MT5Y77U3VI68nfHtp/4EpgorjjkvRdl7HXhv0CXL06CoaXg12zZg9ydNjRc Z/mCudqtVBGJXLR2/egqOc1xECS6WC59tOpts7eY8q0nsP05Co/0TIYOLegpMz0Td/ 6Gq2OYAENvEYRaAbX1p/mSgVMK7hPHdT3LA36oHg= 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 4.19 64/95] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug Date: Mon, 4 Oct 2021 14:52:34 +0200 Message-Id: <20211004125035.660254796@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125033.572932188@linuxfoundation.org> References: <20211004125033.572932188@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 5c5908127fcb..adeee760ab4c 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3264,6 +3264,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