sctp: update the netstamp_needed counter when copying sockets
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Fri, 4 Dec 2015 17:14:04 +0000 (15:14 -0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 6 Dec 2015 03:23:22 +0000 (22:23 -0500)
commit01ce63c90170283a9855d1db4fe81934dddce648
treeeab8388f522d7f71c2e96b343370ac50f6ff64d8
parentcb5e173ed7c03a0d4630ce68a95a186cce3cc872
sctp: update the netstamp_needed counter when copying sockets

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>
include/net/sock.h
net/core/sock.c
net/sctp/socket.c