Skip to content

Commit

Permalink
ethernet: myri10ge: Fix a use after free in myri10ge_sw_tso
Browse files Browse the repository at this point in the history
In myri10ge_sw_tso, the skb_list_walk_safe macro will set
(curr) = (segs) and (next) = (curr)->next. If status!=0 is true,
the memory pointed by curr and segs will be free by dev_kfree_skb_any(curr).
But later, the segs is used by segs = segs->next and causes a uaf.

As (next) = (curr)->next, my patch replaces seg->next to next.

Fixes: 536577f ("net: myri10ge: use skb_list_walk_safe helper for gso segments")
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Lv Yunlong authored and David S. Miller committed Mar 29, 2021
1 parent 5954846 commit 6341576
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/myricom/myri10ge/myri10ge.c
Original file line number Diff line number Diff line change
Expand Up @@ -2897,7 +2897,7 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb,
dev_kfree_skb_any(curr);
if (segs != NULL) {
curr = segs;
segs = segs->next;
segs = next;
curr->next = NULL;
dev_kfree_skb_any(segs);
}
Expand Down

0 comments on commit 6341576

Please sign in to comment.