From: Kalle Valo <kvalo@codeaurora.org>
To: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
Lorenzo Bianconi <lorenzo@kernel.org>,
netdev@vger.kernel.org, linux-wireless@vger.kernel.org,
Felix Fietkau <nbd@nbd.name>
Subject: Re: pull-request: wireless-drivers-2021-02-05
Date: Sun, 07 Feb 2021 07:50:06 +0200 [thread overview]
Message-ID: <87r1ls5svl.fsf@codeaurora.org> (raw)
In-Reply-To: <20210206194325.GA134674@lore-desk> (Lorenzo Bianconi's message of "Sat, 6 Feb 2021 20:43:25 +0100")
Lorenzo Bianconi <lorenzo.bianconi@redhat.com> writes:
>> On Fri, 5 Feb 2021 16:34:34 +0000 (UTC) Kalle Valo wrote:
>> > Hi,
>> >
>> > here's a pull request to net tree, more info below. Please let me know if there
>> > are any problems.
>>
>> Pulled, thanks! One thing to confirm tho..
>>
>> > ath9k
>> >
>> > * fix build regression related to LEDS_CLASS
>> >
>> > mt76
>> >
>> > * fix a memory leak
>>
>> Lorenzo, I'm just guessing what this code does, but you're dropping a
>> frag without invalidating the rest of the SKB, which I presume is now
>> truncated? Shouldn't the skb be dropped?
>>
>
> Hi Jakub,
>
> I agree. We can do something like:
>
> diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
> index e81dfaf99bcb..6d84533d1df2 100644
> --- a/drivers/net/wireless/mediatek/mt76/dma.c
> +++ b/drivers/net/wireless/mediatek/mt76/dma.c
> @@ -511,8 +511,9 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
> {
> struct sk_buff *skb = q->rx_head;
> struct skb_shared_info *shinfo = skb_shinfo(skb);
> + int nr_frags = shinfo->nr_frags;
>
> - if (shinfo->nr_frags < ARRAY_SIZE(shinfo->frags)) {
> + if (nr_frags < ARRAY_SIZE(shinfo->frags)) {
> struct page *page = virt_to_head_page(data);
> int offset = data - page_address(page) + q->buf_offset;
>
> @@ -526,7 +527,10 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
> return;
>
> q->rx_head = NULL;
> - dev->drv->rx_skb(dev, q - dev->q_rx, skb);
> + if (nr_frags < ARRAY_SIZE(shinfo->frags))
> + dev->drv->rx_skb(dev, q - dev->q_rx, skb);
> + else
> + dev_kfree_skb(skb);
> }
>
>
> I do not know if it can occur, but I guess we should even check q->rx_head
> pointer before overwriting it because if the hw does not report more set to
> false for last fragment we will get a memory leak as well. Something like:
>
> @@ -578,6 +582,8 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
> done++;
>
> if (more) {
> + if (q->rx_head)
> + dev_kfree_skb(q->rx_head);
> q->rx_head = skb;
> continue;
> }
So what's the plan? Is there going to be a followup patch? And should
that also go to v5.11 or can it wait v5.12?
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2021-02-07 5:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-05 16:34 pull-request: wireless-drivers-2021-02-05 Kalle Valo
2021-02-06 17:35 ` Jakub Kicinski
2021-02-06 19:43 ` Lorenzo Bianconi
2021-02-06 19:50 ` Jakub Kicinski
2021-02-07 5:50 ` Kalle Valo [this message]
2021-02-07 10:06 ` Lorenzo Bianconi
2021-02-07 11:51 ` Lorenzo Bianconi
2021-02-08 8:14 ` Kalle Valo
2021-02-08 8:22 ` Lorenzo Bianconi
2021-02-08 17:51 ` Jakub Kicinski
2021-02-06 17:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r1ls5svl.fsf@codeaurora.org \
--to=kvalo@codeaurora.org \
--cc=kuba@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).