]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/blobdiff - drivers/net/tun.c
tuntap: dont use skb after netif_rx_ni(skb)
[can-eth-gw-linux.git] / drivers / net / tun.c
index 2ac2164a1e39bd70b0a046ee6dc7df05b76e1045..40b426edc9e6cbab7babc20ee4cb7a9dd2f0bbc6 100644 (file)
@@ -297,13 +297,12 @@ static void tun_flow_cleanup(unsigned long data)
        spin_unlock_bh(&tun->lock);
 }
 
-static void tun_flow_update(struct tun_struct *tun, struct sk_buff *skb,
+static void tun_flow_update(struct tun_struct *tun, u32 rxhash,
                            u16 queue_index)
 {
        struct hlist_head *head;
        struct tun_flow_entry *e;
        unsigned long delay = tun->ageing_time;
-       u32 rxhash = skb_get_rxhash(skb);
 
        if (!rxhash)
                return;
@@ -1010,6 +1009,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
        int copylen;
        bool zerocopy = false;
        int err;
+       u32 rxhash;
 
        if (!(tun->flags & TUN_NO_PI)) {
                if ((len -= sizeof(pi)) > total_len)
@@ -1162,12 +1162,13 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
                skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
        }
 
+       rxhash = skb_get_rxhash(skb);
        netif_rx_ni(skb);
 
        tun->dev->stats.rx_packets++;
        tun->dev->stats.rx_bytes += len;
 
-       tun_flow_update(tun, skb, tfile->queue_index);
+       tun_flow_update(tun, rxhash, tfile->queue_index);
        return total_len;
 }