From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75518C04E53 for ; Wed, 15 May 2019 11:58:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E13D20657 for ; Wed, 15 May 2019 11:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557921516; bh=yIyJkzzQjrTWbjqp2MxSyWJme/g22/0eI+Om+vpCOBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=yxfV0Luol86Tb8uAg1JozVm0NQ9701fEwlKi1mUe8TkHj/Ya52ABSUpvHb2fjODkH eq0KmKnIV5EbEyseIueb/0l3FL0cZnjoUwVroGkb97+Qjw2TXG9IOzW/9WzehIOgSt ztqWE4toLlFe2dLKWGryHgcJTtWLm6LoACoKRaho= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730154AbfEOLQG (ORCPT ); Wed, 15 May 2019 07:16:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:52716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726879AbfEOLQF (ORCPT ); Wed, 15 May 2019 07:16:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E464520843; Wed, 15 May 2019 11:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557918964; bh=yIyJkzzQjrTWbjqp2MxSyWJme/g22/0eI+Om+vpCOBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gEWZA4jQ2vtK8oDPUJmd8RxUEovTU+jF5QNKiJ7G66KtYLy3sMDL9myVHMEHv0ALo 3VoGZA1ciLFeqK6DCQa1JVFgAYB3zrthfQ7BWDuV5FhzyrYoe7ocMCuBG5GhuGSa2f jRpYaljmanfH/o1DzSKRNM7CzqJR0oZSdY+AyBsg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Johannes Berg , Sasha Levin Subject: [PATCH 4.14 016/115] mac80211: fix memory accounting with A-MSDU aggregation Date: Wed, 15 May 2019 12:54:56 +0200 Message-Id: <20190515090700.479527633@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090659.123121100@linuxfoundation.org> References: <20190515090659.123121100@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ Upstream commit eb9b64e3a9f8483e6e54f4e03b2ae14ae5db2690 ] skb->truesize can change due to memory reallocation or when adding extra fragments. Adjust fq->memory_usage accordingly Signed-off-by: Felix Fietkau Acked-by: Toke Høiland-Jørgensen Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/tx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 305a4655f23e1..09c7aa519ca82 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3125,6 +3125,7 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, u8 max_subframes = sta->sta.max_amsdu_subframes; int max_frags = local->hw.max_tx_fragments; int max_amsdu_len = sta->sta.max_amsdu_len; + int orig_truesize; __be16 len; void *data; bool ret = false; @@ -3158,6 +3159,7 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, if (!head) goto out; + orig_truesize = head->truesize; orig_len = head->len; if (skb->len + head->len > max_amsdu_len) @@ -3212,6 +3214,7 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, *frag_tail = skb; out_recalc: + fq->memory_usage += head->truesize - orig_truesize; if (head->len != orig_len) { flow->backlog += head->len - orig_len; tin->backlog_bytes += head->len - orig_len; -- 2.20.1