In rtl8169_start_xmit, it calls rtl8169_tso_csum_v2(tp, skb, opts) and
rtl8169_tso_csum_v2() calls __skb_put_padto(skb, padto, false). If
__skb_put_padto() failed, it will free the skb in the first time and
return error. Then rtl8169_start_xmit will goto err_dma_0.
But in err_dma_0 label, the skb is freed by dev_kfree_skb_any(skb) in
the second time.
My patch adds a new label inside the old err_dma_0 label to avoid the
double free and renames the error labels to keep the origin function
unchanged.
Fixes: b8447abc4c8fb ("r8169: factor out rtl8169_tx_map")
Signed-off-by: Lv Yunlong <redacted>
---
drivers/net/ethernet/realtek/r8169_main.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
In rtl8169_start_xmit, it calls rtl8169_tso_csum_v2(tp, skb, opts) and
rtl8169_tso_csum_v2() calls __skb_put_padto(skb, padto, false). If
__skb_put_padto() failed, it will free the skb in the first time and
return error. Then rtl8169_start_xmit will goto err_dma_0.
No, the skb isn't freed here in case of error. Have a look at the
implementation of __skb_put_padto() and see also cc6528bc9a0c
("r8169: fix potential skb double free in an error path").
quoted hunk
But in err_dma_0 label, the skb is freed by dev_kfree_skb_any(skb) in
the second time.
My patch adds a new label inside the old err_dma_0 label to avoid the
double free and renames the error labels to keep the origin function
unchanged.
Fixes: b8447abc4c8fb ("r8169: factor out rtl8169_tx_map")
Signed-off-by: Lv Yunlong <redacted>
---
drivers/net/ethernet/realtek/r8169_main.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
In rtl8169_start_xmit, it calls rtl8169_tso_csum_v2(tp, skb, opts) and
rtl8169_tso_csum_v2() calls __skb_put_padto(skb, padto, false). If
__skb_put_padto() failed, it will free the skb in the first time and
return error. Then rtl8169_start_xmit will goto err_dma_0.
No, the skb isn't freed here in case of error. Have a look at the
implementation of __skb_put_padto() and see also cc6528bc9a0c
("r8169: fix potential skb double free in an error path").
quoted
But in err_dma_0 label, the skb is freed by dev_kfree_skb_any(skb) in
the second time.
My patch adds a new label inside the old err_dma_0 label to avoid the
double free and renames the error labels to keep the origin function
unchanged.
Fixes: b8447abc4c8fb ("r8169: factor out rtl8169_tx_map")
Signed-off-by: Lv Yunlong <redacted>
---
drivers/net/ethernet/realtek/r8169_main.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)