sock: free skb in skb_complete_tx_timestamp on error
Subsystems (2)
PATCH 1/1 sock: free skb in skb_complete_tx_timestamp on error
From: Willem de Bruijn <[email protected]>
skb_complete_tx_timestamp must ingest the skb it is passed. Call kfree_skb if the skb cannot be enqueued.
Fixes b245be1f4db1 ("net-timestamp: no-payload only sysctl")
Fixes 9ac25fc06375 ("net: fix socket refcounting in skb_complete_tx_timestamp()")
Reported-by Richard Cochran <[email protected]>
Signed-off-by Willem de Bruijn <[email protected]>
--- net/core/skbuff.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/core/skbuff.c +5 -1
@@ -4293,7 +4293,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.
@@ -4302,7 +4302,11 @@ void skb_complete_tx_timestamp(struct sk_buff *skb, *skb_hwtstamps (skb) = *hwtstamps;__skb_complete_tx_timestamp (skb, sk,SCM_TSTAMP_SND , false);sock_put (sk); +return ; } + +err: +kfree_skb (skb); }EXPORT_SYMBOL_GPL (skb_complete_tx_timestamp);
Signature · 1 line
2.15.1.504.g5279b80103-goog
Quoted 10 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
skb_complete_tx_timestampmust ingest the skb it is passed. Callkfree_skbif the skb cannot be enqueued.Fixes b245be1f4db1 ("net-timestamp: no-payload only sysctl")Fixes 9ac25fc06375 ("net: fix socket refcounting in skb_complete_tx_timestamp()")Reported-by Richard Cochran <[email protected]>Signed-off-by Willem de Bruijn <[email protected]>---
Reviewed-by Eric Dumazet <[email protected]>
Thanks !
David Miller
maintainerFrom: Willem de Bruijn <[email protected]>
Date: Wed, 13 Dec 2017 14:41:06 -0500
Quoted 9 lines
From: Willem de Bruijn <[email protected]>
skb_complete_tx_timestampmust ingest the skb it is passed. Callkfree_skbif the skb cannot be enqueued.Fixes b245be1f4db1 ("net-timestamp: no-payload only sysctl")Fixes 9ac25fc06375 ("net: fix socket refcounting in skb_complete_tx_timestamp()")Reported-by Richard Cochran <[email protected]>Signed-off-by Willem de Bruijn <[email protected]>
Applied and queued up for -stable.