[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <857f3f9c-abc3-779e-d03b-76c23f6e13af@suse.de>
Date: Wed, 6 Apr 2022 15:33:49 +0300
From: Denis Kirjanov <dkirjanov@...e.de>
To: Xiaomeng Tong <xiam0nd.tong@...il.com>, christopher.lee@...i.com,
davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] myri10ge: fix an incorrect free for skb in
myri10ge_sw_tso
4/6/22 06:55, Xiaomeng Tong пишет:
> All remaining skbs should be released when myri10ge_xmit fails to
> transmit a packet. Fix it within another skb_list_walk_safe.
>
> Signed-off-by: Xiaomeng Tong <xiam0nd.tong@...il.com>
> ---
>
> changes since v2:
> - free all remaining skbs. (Xiaomeng Tong)
>
> changes since v1:
> - remove the unneeded assignmnets. (Xiaomeng Tong)
>
> v2:https://lore.kernel.org/lkml/20220405000553.21856-1-xiam0nd.tong@gmail.com/
> v1:https://lore.kernel.org/lkml/20220319052350.26535-1-xiam0nd.tong@gmail.com/
>
> ---
> drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> index 50ac3ee2577a..21d2645885ce 100644
> --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> @@ -2903,11 +2903,9 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb,
> status = myri10ge_xmit(curr, dev);
> if (status != 0) {
> dev_kfree_skb_any(curr);
> - if (segs != NULL) {
> - curr = segs;
> - segs = next;
> + skb_list_walk_safe(next, curr, next) {
> curr->next = NULL;
> - dev_kfree_skb_any(segs);
> + dev_kfree_skb_any(curr);
why can't we just do the following?
skb_list_walk_safe(segs, skb, nskb) {
status = myri10ge_xmit(curr, dev);
if (err)
break;
}
/* Free all of the segments. */
skb_list_walk_safe(segs, skb, nskb) {
if (err)
kfree_skb(skb);
else
consume_skb(skb);
}
return err;
> }
> goto drop;
> }
Powered by blists - more mailing lists