From d2dba226acb9baed97a714e0f7f81a89b2feb63b Mon Sep 17 00:00:00 2001 From: Dongli Zhang Date: Fri, 4 Mar 2022 06:55:06 -0800 Subject: [PATCH] net: tun: split run_ebpf_filter() and pskb_trim() into different "if statement" [ Upstream commit 45a15d89fbcd280571eba8e5ca309e14ba6afa8f ] 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 Cc: Joe Jin Signed-off-by: Dongli Zhang Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/tun.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index ea60453..f92d6a1 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1097,7 +1097,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))) -- 2.7.4