Re: [PATCH v1] wifi: mt76: mt792x: fix memory leak in USB TX path

Devin Wittmayer <[email protected]>
Newsgroups org.kernel.vger.linux-wireless,org.infradead.lists.linux-mediatek
Message-ID <[email protected]>
Following up on the first hunk. Looking at that path again, there is a failure
behind it I did not account for on 08-06.

mt76_skb_adjust_pad() calls skb_pad(), which frees the skb on failure, and
today mt76u_tx_queue_skb() correctly returns without touching it. Routing that
exit to err_free_skb: frees it a second time. Special casing does not help,
since skb_cow_head() on the same exit also returns -ENOMEM and is safe.

The prerequisite, in mt76_skb_adjust_pad():

	-	if (skb_pad(last, pad))
	+	if (__skb_pad(last, pad, false))

It reaches mt7925 and SDIO too, so probably its own patch ahead of yours.

Worth flagging as well: mt76s_tx_queue_skb is not a model here, it has the same
two exits and the same missing free.

I have mt7921u here if you want a v2 tested.

Devin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.