[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171127143605.Horde.e1mO3GN28r_3LfsfiZdmeqJ@gator4166.hostgator.com>
Date: Mon, 27 Nov 2017 14:36:05 -0600
From: "Gustavo A. R. Silva" <garsilva@...eddedor.com>
To: David Howells <dhowells@...hat.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rxrpc: sendmsg: Fix variable overwrite in
rxrpc_queue_packet
Hi David,
Quoting David Howells <dhowells@...hat.com>:
> Gustavo A. R. Silva <garsilva@...eddedor.com> wrote:
>
>> Value assigned to variable resend_at is overwritten before it can be used.
>>
>> Fix this by removing the value overwrite as it seems that this is a
>> leftover code.
>
> NAK. Your fix will actually cause the code to break.
>
> The resend_at value used for the timer must be based on the current time
> (ie. jiffies in this case), so we can't simply remove that line as the
> previously calculated resend_at value is a duration, not a time.
>
> What you need to do is to instead modify the line you wanted to remove to add
> 'now' to the previously-computed value.
>
You mean something like the following?
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -233,7 +233,7 @@ static void rxrpc_queue_packet(struct rxrpc_sock
*rx, struct rxrpc_call *call,
if (resend_at < 1)
resend_at = 1;
- resend_at = now + rxrpc_resend_timeout;
+ resend_at += now;
WRITE_ONCE(call->resend_at, resend_at);
rxrpc_reduce_call_timer(call, resend_at, now,
rxrpc_timer_set_for_send);
Thanks
--
Gustavo A. R. Silva
Powered by blists - more mailing lists