]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ethernet: myri10ge: Fix a use after free in myri10ge_sw_tso
authorLv Yunlong <lyl2019@mail.ustc.edu.cn>
Mon, 29 Mar 2021 12:36:48 +0000 (05:36 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Mar 2021 20:41:17 +0000 (13:41 -0700)
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: 536577f36ff7a ("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>
drivers/net/ethernet/myricom/myri10ge/myri10ge.c

index 1634ca6d4a8f02ec9e86c287d5eb0d4807648dc5..c84c8bf2bc20eaefb6711b5836652502f9196da8 100644 (file)
@@ -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);
                        }