diff options
author | Marc Dionne <marc.dionne@auristor.com> | 2018-03-30 21:04:44 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2018-03-30 21:04:44 +0100 |
commit | 59299aa1028fce051adbd25aaff7c387b865cd6d (patch) | |
tree | 5c02b8a8a6e772dc42e387ba6bd88dba08248b96 /net/rxrpc | |
parent | 57b0c9d49b94bbeb53649b7fbd264603c1ebd585 (diff) | |
download | linux-59299aa1028fce051adbd25aaff7c387b865cd6d.tar.bz2 |
rxrpc: Fix resend event time calculation
Commit a158bdd3 ("rxrpc: Fix call timeouts") reworked the time calculation
for the next resend event. For this calculation, "oldest" will be before
"now", so ktime_sub(oldest, now) will yield a negative value. When passed
to nsecs_to_jiffies which expects an unsigned value, the end result will be
a very large value, and a resend event scheduled far into the future. This
could cause calls to stall if some packets were lost.
Fix by ordering the arguments to ktime_sub correctly.
Fixes: a158bdd3247b ("rxrpc: Fix call timeouts")
Signed-off-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/rxrpc')
-rw-r--r-- | net/rxrpc/call_event.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c index 3dee89c7a06e..6e0d788b4dc4 100644 --- a/net/rxrpc/call_event.c +++ b/net/rxrpc/call_event.c @@ -226,7 +226,7 @@ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j) ktime_to_ns(ktime_sub(skb->tstamp, max_age))); } - resend_at = nsecs_to_jiffies(ktime_to_ns(ktime_sub(oldest, now))); + resend_at = nsecs_to_jiffies(ktime_to_ns(ktime_sub(now, oldest))); resend_at += jiffies + rxrpc_resend_timeout; WRITE_ONCE(call->resend_at, resend_at); |