summaryrefslogtreecommitdiff
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>2015-12-04 15:14:04 -0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-01-22 20:34:53 -0800
commit548041a38c62684077b4dc85adec814faac193e7 (patch)
tree5ce80624e0061c95b1a49ec05cb7d3235d63ae99 /net/sctp/socket.c
parentf580d5c5de89593d6d3785340979df61c972769d (diff)
downloadlwn-548041a38c62684077b4dc85adec814faac193e7.tar.gz
lwn-548041a38c62684077b4dc85adec814faac193e7.zip
sctp: update the netstamp_needed counter when copying sockets
[ Upstream commit 01ce63c90170283a9855d1db4fe81934dddce648 ] Dmitry Vyukov reported that SCTP was triggering a WARN on socket destroy related to disabling sock timestamp. When SCTP accepts an association or peel one off, it copies sock flags but forgot to call net_enable_timestamp() if a packet timestamping flag was copied, leading to extra calls to net_disable_timestamp() whenever such clones were closed. The fix is to call net_enable_timestamp() whenever we copy a sock with that flag on, like tcp does. Reported-by: Dmitry Vyukov <dvyukov@google.com> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Acked-by: Vlad Yasevich <vyasevich@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 7b0646e9f324..a7400f65b9b5 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -6985,6 +6985,9 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
newinet->mc_ttl = 1;
newinet->mc_index = 0;
newinet->mc_list = NULL;
+
+ if (newsk->sk_flags & SK_FLAGS_TIMESTAMP)
+ net_enable_timestamp();
}
static inline void sctp_copy_descendant(struct sock *sk_to,