]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: tun: split run_ebpf_filter() and pskb_trim() into different "if statement"
authorDongli Zhang <dongli.zhang@oracle.com>
Fri, 4 Mar 2022 14:55:06 +0000 (06:55 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 6 Mar 2022 11:04:01 +0000 (11:04 +0000)
No functional change.

Just to split the if statement into different conditions to use
kfree_skb_reason() to trace the reason later.

Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c

index 2a0d8a5d7aec92bab87a1c3b3919c35cd9633f19..6e06c846fe82edeefbc6304e08de714943ea846b 100644 (file)
@@ -1086,7 +1086,10 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
                goto drop;
 
        len = run_ebpf_filter(tun, skb, len);
-       if (len == 0 || pskb_trim(skb, len))
+       if (len == 0)
+               goto drop;
+
+       if (pskb_trim(skb, len))
                goto drop;
 
        if (unlikely(skb_orphan_frags_rx(skb, GFP_ATOMIC)))