All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH wireless] brcmfmac: fix potential memory leak in brcmf_netdev_start_xmit()
@ 2022-11-17  3:54 Zhang Changzhong
  2022-11-17 10:09 ` Kalle Valo
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Changzhong @ 2022-11-17  3:54 UTC (permalink / raw)
  To: Arend van Spriel, Franky Lin, Hante Meuleman, Kalle Valo,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Pieter-Paul Giesberts
  Cc: Zhang Changzhong, linux-wireless, brcm80211-dev-list.pdl,
	SHA-cyfmac-dev-list, netdev, linux-kernel

The brcmf_netdev_start_xmit() returns NETDEV_TX_OK without freeing skb
in case of pskb_expand_head() fails, add dev_kfree_skb() to fix it.

Fixes: 270a6c1f65fe ("brcmfmac: rework headroom check in .start_xmit()")
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 595ae3a..175272c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -335,6 +335,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
 			bphy_err(drvr, "%s: failed to expand headroom\n",
 				 brcmf_ifname(ifp));
 			atomic_inc(&drvr->bus_if->stats.pktcow_failed);
+			dev_kfree_skb(skb);
 			goto done;
 		}
 	}
-- 
2.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH wireless] brcmfmac: fix potential memory leak in brcmf_netdev_start_xmit()
  2022-11-17  3:54 [PATCH wireless] brcmfmac: fix potential memory leak in brcmf_netdev_start_xmit() Zhang Changzhong
@ 2022-11-17 10:09 ` Kalle Valo
  2022-11-17 11:04   ` Zhang Changzhong
  0 siblings, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2022-11-17 10:09 UTC (permalink / raw)
  To: Zhang Changzhong
  Cc: Arend van Spriel, Franky Lin, Hante Meuleman, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Pieter-Paul Giesberts,
	linux-wireless, brcm80211-dev-list.pdl, SHA-cyfmac-dev-list,
	netdev, linux-kernel

Zhang Changzhong <zhangchangzhong@huawei.com> writes:

> The brcmf_netdev_start_xmit() returns NETDEV_TX_OK without freeing skb
> in case of pskb_expand_head() fails, add dev_kfree_skb() to fix it.
>
> Fixes: 270a6c1f65fe ("brcmfmac: rework headroom check in .start_xmit()")
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>

I assume you have not tested this on a real device? Then it would be
really important to add "Compile tested only" to the commit log so that
we know it's untested.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH wireless] brcmfmac: fix potential memory leak in brcmf_netdev_start_xmit()
  2022-11-17 10:09 ` Kalle Valo
@ 2022-11-17 11:04   ` Zhang Changzhong
  2022-11-18 18:43     ` Kalle Valo
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Changzhong @ 2022-11-17 11:04 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Arend van Spriel, Franky Lin, Hante Meuleman, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Pieter-Paul Giesberts,
	linux-wireless, brcm80211-dev-list.pdl, SHA-cyfmac-dev-list,
	netdev, linux-kernel

On 2022/11/17 18:09, Kalle Valo wrote:
> Zhang Changzhong <zhangchangzhong@huawei.com> writes:
> 
>> The brcmf_netdev_start_xmit() returns NETDEV_TX_OK without freeing skb
>> in case of pskb_expand_head() fails, add dev_kfree_skb() to fix it.
>>
>> Fixes: 270a6c1f65fe ("brcmfmac: rework headroom check in .start_xmit()")
>> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
> 
> I assume you have not tested this on a real device? Then it would be
> really important to add "Compile tested only" to the commit log so that
> we know it's untested.
> 

OK, I'll add "Compile tested only" to the next version and other untested
patches.

Thanks,
Changzhong

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH wireless] brcmfmac: fix potential memory leak in brcmf_netdev_start_xmit()
  2022-11-17 11:04   ` Zhang Changzhong
@ 2022-11-18 18:43     ` Kalle Valo
  0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2022-11-18 18:43 UTC (permalink / raw)
  To: Zhang Changzhong
  Cc: Arend van Spriel, Franky Lin, Hante Meuleman, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Pieter-Paul Giesberts,
	linux-wireless, brcm80211-dev-list.pdl, SHA-cyfmac-dev-list,
	netdev, linux-kernel

Zhang Changzhong <zhangchangzhong@huawei.com> writes:

> On 2022/11/17 18:09, Kalle Valo wrote:
>> Zhang Changzhong <zhangchangzhong@huawei.com> writes:
>> 
>>> The brcmf_netdev_start_xmit() returns NETDEV_TX_OK without freeing skb
>>> in case of pskb_expand_head() fails, add dev_kfree_skb() to fix it.
>>>
>>> Fixes: 270a6c1f65fe ("brcmfmac: rework headroom check in .start_xmit()")
>>> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
>> 
>> I assume you have not tested this on a real device? Then it would be
>> really important to add "Compile tested only" to the commit log so that
>> we know it's untested.
>> 
>
> OK, I'll add "Compile tested only" to the next version and other untested
> patches.

Thanks. I wish it would become common to use that "Compile tested only".

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-18 18:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17  3:54 [PATCH wireless] brcmfmac: fix potential memory leak in brcmf_netdev_start_xmit() Zhang Changzhong
2022-11-17 10:09 ` Kalle Valo
2022-11-17 11:04   ` Zhang Changzhong
2022-11-18 18:43     ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.