@@ -1341,6 +1341,7 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
drop:
atomic_inc(&sk->sk_drops);
busylock_release(busy);
+ kfree_skb(skb);
return err;
}
EXPORT_SYMBOL_GPL(__udp_enqueue_schedule_skb);
@@ -1802,7 +1803,6 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
UDP_INC_STATS(sock_net(sk), UDP_MIB_RCVBUFERRORS,
is_udplite);
UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
- kfree_skb(skb);
trace_udp_fail_queue_rcv_skb(rc, sk);
return -1;
}
@@ -532,7 +532,6 @@ static int __udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
UDP6_INC_STATS(sock_net(sk),
UDP_MIB_RCVBUFERRORS, is_udplite);
UDP6_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
- kfree_skb(skb);
return -1;
}
This commit moves the kfree_skb() call on queue full event from the ipv4/ipv6 caller into __udp_enqueue_schedule_skb(), cleaning up the code and avoid referencing the skb after that __udp_enqueue_schedule_skb() completes, so that we can modify the skb ptr itself into the latter function. Signed-off-by: Paolo Abeni <pabeni@redhat.com> --- net/ipv4/udp.c | 2 +- net/ipv6/udp.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)