]> git.baikalelectronics.ru Git - kernel.git/commitdiff
can: cc770: Fix use after free in cc770_tx_interrupt()
authorAndri Yngvason <andri.yngvason@marel.com>
Thu, 15 Mar 2018 18:23:17 +0000 (18:23 +0000)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 19 Mar 2018 09:57:29 +0000 (10:57 +0100)
This fixes use after free introduced by the last cc770 patch.

Signed-off-by: Andri Yngvason <andri.yngvason@marel.com>
Fixes: 2930a84c57e8 ("can: cc770: Fix queue stall & dropped RTR reply")
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/cc770/cc770.c

index 2743d82d4424d703d047823d4ee278c2b865f435..6da69af103e60d9e26ed30815fc946be56aee224 100644 (file)
@@ -706,13 +706,12 @@ static void cc770_tx_interrupt(struct net_device *dev, unsigned int o)
                return;
        }
 
-       can_put_echo_skb(priv->tx_skb, dev, 0);
-       can_get_echo_skb(dev, 0);
-
        cf = (struct can_frame *)priv->tx_skb->data;
        stats->tx_bytes += cf->can_dlc;
        stats->tx_packets++;
 
+       can_put_echo_skb(priv->tx_skb, dev, 0);
+       can_get_echo_skb(dev, 0);
        priv->tx_skb = NULL;
 
        netif_wake_queue(dev);