summaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorDongli Zhang <dongli.zhang@oracle.com>2022-03-04 06:55:06 -0800
committerDavid S. Miller <davem@davemloft.net>2022-03-06 11:04:01 +0000
commit45a15d89fbcd280571eba8e5ca309e14ba6afa8f (patch)
tree47d54fb5f8139318bf3d8b3f4ee9d0ae833b395d /drivers/net/tun.c
parent736f16de75f9bb32d76f652cb66f04d1bc685057 (diff)
downloadlinux-45a15d89fbcd280571eba8e5ca309e14ba6afa8f.tar.gz
linux-45a15d89fbcd280571eba8e5ca309e14ba6afa8f.tar.bz2
linux-45a15d89fbcd280571eba8e5ca309e14ba6afa8f.zip
net: tun: split run_ebpf_filter() and pskb_trim() into different "if statement"
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>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 2a0d8a5d7aec..6e06c846fe82 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -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)))