mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 21:07:02 +09:00
net: fix socket refcounting in skb_complete_tx_timestamp()
am: ec4d8692b7
Change-Id: Idc05607ffe99175575d7f07e3138e2f4496a5110
This commit is contained in:
@@ -3678,13 +3678,14 @@ void skb_complete_tx_timestamp(struct sk_buff *skb,
|
||||
if (!skb_may_tx_timestamp(sk, false))
|
||||
return;
|
||||
|
||||
/* take a reference to prevent skb_orphan() from freeing the socket */
|
||||
sock_hold(sk);
|
||||
|
||||
*skb_hwtstamps(skb) = *hwtstamps;
|
||||
__skb_complete_tx_timestamp(skb, sk, SCM_TSTAMP_SND);
|
||||
|
||||
sock_put(sk);
|
||||
/* Take a reference to prevent skb_orphan() from freeing the socket,
|
||||
* but only if the socket refcount is not zero.
|
||||
*/
|
||||
if (likely(atomic_inc_not_zero(&sk->sk_refcnt))) {
|
||||
*skb_hwtstamps(skb) = *hwtstamps;
|
||||
__skb_complete_tx_timestamp(skb, sk, SCM_TSTAMP_SND);
|
||||
sock_put(sk);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(skb_complete_tx_timestamp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user