[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121008103812.GA21577@secunet.com>
Date: Mon, 8 Oct 2012 12:38:12 +0200
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH 3/3] ipv4: Don't report stale pmtu values to userspace
On Mon, Oct 08, 2012 at 11:55:44AM +0200, Eric Dumazet wrote:
> On Mon, 2012-10-08 at 10:48 +0200, Steffen Klassert wrote:
> > We report cached pmtu values even if they are already expired.
> > Change this to not report these values after they are expired.
> >
> > Signed-off-by: Steffen Klassert <steffen.klassert@...unet.com>
> > ---
> > net/ipv4/route.c | 17 +++++++++--------
> > 1 files changed, 9 insertions(+), 8 deletions(-)
> >
> > diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> > index 741df67..24b52dd 100644
> > --- a/net/ipv4/route.c
> > +++ b/net/ipv4/route.c
> > @@ -2187,8 +2187,16 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
> > nla_put_be32(skb, RTA_GATEWAY, rt->rt_gateway))
> > goto nla_put_failure;
> >
> > + expires = rt->dst.expires;
> > + if (expires) {
> > + if (time_before(jiffies, expires))
> > + expires -= jiffies;
>
> Seeing this racy code, we could fix it as well.
Sure, we can :)
>
> jiffies is volatile and can change between the test and subtraction.
>
> So we could in theory get strange result.
>
> I suggest using :
>
> if (expires) {
> unsigned long now = jiffies;
>
> if (time_before(now, expires))
> expires -= now;
> else
> expires = 0;
> }
I'll go with the version above and send an updated patch.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists