FAILED: patch "[PATCH] can: usb_8dev: usb_8dev_start_xmit(): fix double" failed to apply to 5.10-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 3d3925ff6433f98992685a9679613a2cc97f3ce2 Mon Sep 17 00:00:00 2001
From: Hangyu Hua <[email protected]>
Date: Fri, 11 Mar 2022 16:06:14 +0800
Subject: [PATCH] can: usb_8dev: usb_8dev_start_xmit(): fix double
dev_kfree_skb() in error path
There is no need to call dev_kfree_skb() when usb_submit_urb() fails because can_put_echo_skb() deletes original skb and can_free_echo_skb() deletes the cloned skb.
drivers/net/can/usb/usb_8dev.c +14 -16
@@ -663,9 +663,20 @@ static netdev_tx_t usb_8dev_start_xmit(struct sk_buff *skb,atomic_inc (&priv->active_tx_urbs); err =usb_submit_urb (urb,GFP_ATOMIC ); -if (unlikely (err)) - goto failed; -else if (atomic_read (&priv->active_tx_urbs) >=MAX_TX_URBS ) +if (unlikely (err)) { +can_free_echo_skb (netdev, context->echo_index,NULL ); + +usb_unanchor_urb (urb); +usb_free_coherent (priv->udev, size, buf, urb->transfer_dma); + +atomic_dec (&priv->active_tx_urbs); + +if (err == -ENODEV ) +netif_device_detach (netdev); +else +netdev_warn (netdev,"failed tx_urb %d\n" , err); + stats->tx_dropped++; + }else if (atomic_read (&priv->active_tx_urbs) >=MAX_TX_URBS )/* Slow down tx path */ netif_stop_queue (netdev);
@@ -684,19 +695,6 @@ static netdev_tx_t usb_8dev_start_xmit(struct sk_buff *skb,return NETDEV_TX_BUSY ; -failed: -can_free_echo_skb (netdev, context->echo_index,NULL ); - -usb_unanchor_urb (urb); -usb_free_coherent (priv->udev, size, buf, urb->transfer_dma); - -atomic_dec (&priv->active_tx_urbs); - -if (err == -ENODEV ) -netif_device_detach (netdev); -else -netdev_warn (netdev,"failed tx_urb %d\n" , err); - nomembuf:usb_free_urb (urb);
Marc Kleine-Budde
maintainerQuoted 5 lines · On 01.04.2022 14:21:24, [email protected] wrote:
The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Done - should be available at:
| https://lore.kernel.org/all/[email protected]/
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |