Skip to content

Commit

Permalink
net: tun: split run_ebpf_filter() and pskb_trim() into different "if …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Dongli Zhang authored and David S. Miller committed Mar 6, 2022
1 parent 736f16d commit 45a15d8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 45a15d8

Please sign in to comment.