linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ethernet: myri10ge: Fix a use after free in myri10ge_sw_tso
@ 2021-03-29 12:36 Lv Yunlong
  2021-03-29 20:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Lv Yunlong @ 2021-03-29 12:36 UTC (permalink / raw)
  To: christopher.lee, davem, kuba; +Cc: netdev, linux-kernel, Lv Yunlong

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>
---
 drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 1634ca6d4a8f..c84c8bf2bc20 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -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);
 			}
-- 
2.25.1



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

* Re: [PATCH] ethernet: myri10ge: Fix a use after free in myri10ge_sw_tso
  2021-03-29 12:36 [PATCH] ethernet: myri10ge: Fix a use after free in myri10ge_sw_tso Lv Yunlong
@ 2021-03-29 20:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-29 20:50 UTC (permalink / raw)
  To: Lv Yunlong; +Cc: christopher.lee, davem, kuba, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Mon, 29 Mar 2021 05:36:48 -0700 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - ethernet: myri10ge: Fix a use after free in myri10ge_sw_tso
    https://git.kernel.org/netdev/net/c/63415767a244

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-03-29 20:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 12:36 [PATCH] ethernet: myri10ge: Fix a use after free in myri10ge_sw_tso Lv Yunlong
2021-03-29 20:50 ` patchwork-bot+netdevbpf

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