sock: free skb in skb_complete_tx_timestamp on error
[ Upstream commit35b99dffc3] skb_complete_tx_timestamp must ingest the skb it is passed. Call kfree_skb if the skb cannot be enqueued. Fixes:b245be1f4d("net-timestamp: no-payload only sysctl") Fixes:9ac25fc063("net: fix socket refcounting in skb_complete_tx_timestamp()") Reported-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: Willem de Bruijn <willemb@google.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
623bfb5818
commit
3f54a6d41d
1 changed files with 5 additions and 1 deletions
|
|
@ -3676,7 +3676,7 @@ void skb_complete_tx_timestamp(struct sk_buff *skb,
|
|||
struct sock *sk = skb->sk;
|
||||
|
||||
if (!skb_may_tx_timestamp(sk, false))
|
||||
return;
|
||||
goto err;
|
||||
|
||||
/* Take a reference to prevent skb_orphan() from freeing the socket,
|
||||
* but only if the socket refcount is not zero.
|
||||
|
|
@ -3685,7 +3685,11 @@ void skb_complete_tx_timestamp(struct sk_buff *skb,
|
|||
*skb_hwtstamps(skb) = *hwtstamps;
|
||||
__skb_complete_tx_timestamp(skb, sk, SCM_TSTAMP_SND);
|
||||
sock_put(sk);
|
||||
return;
|
||||
}
|
||||
|
||||
err:
|
||||
kfree_skb(skb);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(skb_complete_tx_timestamp);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue