[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220226084929.6417-4-dongli.zhang@oracle.com>
Date: Sat, 26 Feb 2022 00:49:28 -0800
From: Dongli Zhang <dongli.zhang@...cle.com>
To: netdev@...r.kernel.org, bpf@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
rostedt@...dmis.org, mingo@...hat.com, ast@...nel.org,
daniel@...earbox.net, andrii@...nel.org, imagedong@...cent.com,
joao.m.martins@...cle.com, joe.jin@...cle.com, dsahern@...il.com,
edumazet@...gle.com
Subject: [PATCH net-next v4 3/4] 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@...cle.com>
Cc: Joe Jin <joe.jin@...cle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@...cle.com>
Reviewed-by: David Ahern <dsahern@...nel.org>
---
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 fed85447701a..aa27268edc5f 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)))
--
2.17.1
Powered by blists - more mailing lists