tuntap: enable bh early during processing XDP
authorJason Wang <jasowang@redhat.com>
Wed, 12 Sep 2018 03:17:01 +0000 (11:17 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Sep 2018 16:25:40 +0000 (09:25 -0700)
This patch move the bh enabling a little bit earlier, this will be
used for factoring out the core XDP logic of tuntap.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c

index d3677a544b56401558596779b27b878974478d76..372caf7d67d935b789b9ad82240de367ecf8ab37 100644 (file)
@@ -1726,22 +1726,18 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
                        goto err_xdp;
                }
        }
+       rcu_read_unlock();
+       local_bh_enable();
 
        skb = build_skb(buf, buflen);
-       if (!skb) {
-               rcu_read_unlock();
-               local_bh_enable();
+       if (!skb)
                return ERR_PTR(-ENOMEM);
-       }
 
        skb_reserve(skb, pad - delta);
        skb_put(skb, len);
        get_page(alloc_frag->page);
        alloc_frag->offset += buflen;
 
-       rcu_read_unlock();
-       local_bh_enable();
-
        return skb;
 
 err_redirect: