* [PATCH net] sock: free skb in skb_complete_tx_timestamp on error
@ 2017-12-13 19:41 Willem de Bruijn
2017-12-13 20:10 ` Eric Dumazet
2017-12-15 16:31 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Willem de Bruijn @ 2017-12-13 19:41 UTC (permalink / raw)
To: netdev; +Cc: richardcochran, davem, Willem de Bruijn
From: Willem de Bruijn <willemb@google.com>
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 <richardcochran@gmail.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
net/core/skbuff.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 6b0ff396fa9d..a592ca025fc4 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -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);
--
2.15.1.504.g5279b80103-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] sock: free skb in skb_complete_tx_timestamp on error
2017-12-13 19:41 [PATCH net] sock: free skb in skb_complete_tx_timestamp on error Willem de Bruijn
@ 2017-12-13 20:10 ` Eric Dumazet
2017-12-15 16:31 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2017-12-13 20:10 UTC (permalink / raw)
To: Willem de Bruijn, netdev; +Cc: richardcochran, davem, Willem de Bruijn
On Wed, 2017-12-13 at 14:41 -0500, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
>
> 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 <richardcochran@gmail.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
> ---
Reviewed-by: Eric Dumazet <edumazet@google.com>
Thanks !
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] sock: free skb in skb_complete_tx_timestamp on error
2017-12-13 19:41 [PATCH net] sock: free skb in skb_complete_tx_timestamp on error Willem de Bruijn
2017-12-13 20:10 ` Eric Dumazet
@ 2017-12-15 16:31 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-12-15 16:31 UTC (permalink / raw)
To: willemdebruijn.kernel; +Cc: netdev, richardcochran, willemb
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Wed, 13 Dec 2017 14:41:06 -0500
> From: Willem de Bruijn <willemb@google.com>
>
> 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 <richardcochran@gmail.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-15 16:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-13 19:41 [PATCH net] sock: free skb in skb_complete_tx_timestamp on error Willem de Bruijn
2017-12-13 20:10 ` Eric Dumazet
2017-12-15 16:31 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.