Skip to content

Commit

Permalink
net: mac80211: use skb_list_walk_safe helper for gso segments
Browse files Browse the repository at this point in the history
This is a conversion case for the new function, keeping the flow of the
existing code as intact as possible. We also switch over to using
skb_mark_not_on_list instead of a null write to skb->next.

Finally, this code appeared to have a memory leak in the case where
header building fails before the last gso segment. In that case, the
remaining segments are not freed. So this commit also adds the proper
kfree_skb_list call for the remainder of the skbs.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jason A. Donenfeld authored and David S. Miller committed Jan 14, 2020
1 parent 2670ee7 commit 9f3ef3d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions net/mac80211/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -3949,18 +3949,15 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
}
}

next = skb;
while (next) {
skb = next;
next = skb->next;

skb->prev = NULL;
skb->next = NULL;
skb_list_walk_safe(skb, skb, next) {
skb_mark_not_on_list(skb);

skb = ieee80211_build_hdr(sdata, skb, info_flags,
sta, ctrl_flags);
if (IS_ERR(skb))
if (IS_ERR(skb)) {
kfree_skb_list(next);
goto out;
}

ieee80211_tx_stats(dev, skb->len);

Expand Down

0 comments on commit 9f3ef3d

Please sign in to comment.