Skip to contentSkip to conversation

Patch "sctp: use the same clock as if sock source timestamps were on" has been added to the 4.3-stable tree

PATCH [email protected] 1 participant 1 message Dec 31, 2015

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

sctp: use the same clock as if sock source timestamps were on

to the 4.3-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
sctp-use-the-same-clock-as-if-sock-source-timestamps-were-on.patch
and it can be found in the queue-4.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Wed Dec 30 19:48:47 PST 2015

From: Marcelo Ricardo Leitner <[email protected]>
Date: Fri, 4 Dec 2015 15:14:03 -0200
Subject: sctp: use the same clock as if sock source timestamps were on

From: Marcelo Ricardo Leitner <[email protected]>

[ Upstream commit cb5e173ed7c03a0d4630ce68a95a186cce3cc872 ]

SCTP echoes a cookie o INIT ACK chunks that contains a timestamp, for detecting stale cookies. This cookie is echoed back to the server by the client and then that timestamp is checked.

Thing is, if the listening socket is using packet timestamping, the cookie is encoded with ktime_get() value and checked against ktime_get_real(), as done by __net_timestamp().

The fix is to sctp also use ktime_get_real(), so we can compare bananas with bananas later no matter if packet timestamping was enabled or not.

Fixes 52db882f3fc2 ("net: sctp: migrate cookie life from timeval to ktime")
---
 net/sctp/sm_make_chunk.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/sctp/sm_make_chunk.c +2 -2
@@ -1652,7 +1652,7 @@ static sctp_cookie_param_t *sctp_pack_co
 
 	/* Set an expiration time for the cookie.  */
 	cookie->c.expiration = ktime_add(asoc->cookie_life,
-					 ktime_get());
+					 ktime_get_real());
 
 	/* Copy the peer's init packet.  */
 	memcpy(&cookie->c.peer_init[0], init_chunk->chunk_hdr,
@@ -1780,7 +1780,7 @@ no_hmac:
 	if (sock_flag(ep->base.sk, SOCK_TIMESTAMP))
 		kt = skb_get_ktime(skb);
 	else
-		kt = ktime_get();
+		kt = ktime_get_real();
 
 	if (!asoc && ktime_before(bear_cookie->expiration, kt)) {
 		/*

Patches currently in stable-queue which might be from [email protected] are

queue-4.3/sctp-update-the-netstamp_needed-counter-when-copying-sockets.patch queue-4.3/sctp-also-copy-sk_tsflags-when-copying-the-socket.patch queue-4.3/sctp-use-the-same-clock-as-if-sock-source-timestamps-were-on.patch