linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath6kl: assure headroom of skbuff is writable in .start_xmit()
@ 2017-04-25  9:10 Arend van Spriel
  2017-04-25  9:36 ` James Hughes
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Arend van Spriel @ 2017-04-25  9:10 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, Arend van Spriel

An issue was found brcmfmac driver in which a skbuff in .start_xmit()
callback was actually cloned. So instead of checking for sufficient
headroom it should also be writable. Hence use skb_cow_head() to
check and expand the headroom appropriately.

Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
Hi Kalle,

Did a recursive grep in drivers/net/wireless and found a similar
case in ath6kl. I do not have the hardware to test so this is
only compile tested.

Regards,
Arend
---
 drivers/net/wireless/ath/ath6kl/txrx.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c
index a531e0c..e6b2517 100644
--- a/drivers/net/wireless/ath/ath6kl/txrx.c
+++ b/drivers/net/wireless/ath/ath6kl/txrx.c
@@ -399,15 +399,10 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
 			csum_dest = skb->csum_offset + csum_start;
 		}
 
-		if (skb_headroom(skb) < dev->needed_headroom) {
-			struct sk_buff *tmp_skb = skb;
-
-			skb = skb_realloc_headroom(skb, dev->needed_headroom);
-			kfree_skb(tmp_skb);
-			if (skb == NULL) {
-				dev->stats.tx_dropped++;
-				return 0;
-			}
+		if (skb_cow_head(skb, dev->needed_headroom)) {
+			dev->stats.tx_dropped++;
+			kfree_skb(skb);
+			return 0;
 		}
 
 		if (ath6kl_wmi_dix_2_dot3(ar->wmi, skb)) {
-- 
1.9.1

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

end of thread, other threads:[~2017-05-19  7:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25  9:10 [PATCH] ath6kl: assure headroom of skbuff is writable in .start_xmit() Arend van Spriel
2017-04-25  9:36 ` James Hughes
2017-04-25 11:10   ` Arend Van Spriel
2017-04-25 11:50     ` James Hughes
2017-04-26  8:53 ` Kalle Valo
2017-04-26 15:44   ` Steve deRosier
2017-04-26 18:03     ` Arend Van Spriel
2017-04-26 19:54       ` James Hughes
2017-04-27  4:55         ` Steve deRosier
2017-04-27  8:54           ` James Hughes
2017-05-04 13:08           ` Kalle Valo
     [not found] ` <20170426085337.293296148E@smtp.codeaurora.org>
2017-04-26  9:00   ` Arend van Spriel
2017-05-19  7:48 ` Kalle Valo

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).