From: Eric Dumazet <eric.dumazet@gmail.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>,
Gao feng <gaofeng@cn.fujitsu.com>, Jiri Bohac <jbohac@suse.cz>
Subject: Re: [RFC PATCH] ipv6: Split from and expires field in dst_entry out of union [net-next]
Date: Tue, 19 Feb 2013 13:55:58 -0800 [thread overview]
Message-ID: <1361310958.19353.164.camel@edumazet-glaptop> (raw)
In-Reply-To: <20130219214934.GD31871@hmsreliant.think-freely.org>
On Tue, 2013-02-19 at 16:49 -0500, Neil Horman wrote:
> On Tue, Feb 19, 2013 at 01:17:45PM -0800, Eric Dumazet wrote:
> > On Tue, 2013-02-19 at 15:28 -0500, Neil Horman wrote:
> >
> > > static inline void rt6_update_expires(struct rt6_info *rt, int timeout)
> > > {
> > > if (!(rt->rt6i_flags & RTF_EXPIRES)) {
> > > - if (rt->dst.from)
> > > - dst_release(rt->dst.from);
> > > + dst_release(rt->dst.from);
> > > /* dst_set_expires relies on expires == 0
> > > * if it has not been set previously.
> > > */
> > > rt->dst.expires = 0;
> > > + rt6->dst.from = NULL;
> > > }
> > >
> >
> > Sorry you didnt really address the problem, only reduce the race window.
> >
> I kinda had a feeling you would say that, but the only other solution I see here
> is to either introduce some locking to protect the from pointer, or two revert
> the patch that introduced the from pointer alltogether, neither of which sounds
> appealing to me. I suppose we could use an xchng to atomically update the from
> pointer, so there was only ever one context that was able to free it in
> rt6_update_path. Does that seem reasonable to you?
I believe the setting of rt6->dst.from is safe :
It should be done at :
- dst creation time, when we are the only user.
- dst destry time, when we are the only user.
We only have to do the dst_release() at the right place, when we are the
last user of the dst.
So rt6_update_expires() should not mess with rt6->dst.from at all.
next prev parent reply other threads:[~2013-02-19 21:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-18 23:55 [RFC] ipv6: rt6_update_expires() seems racy Eric Dumazet
2013-02-19 20:28 ` [RFC PATCH] ipv6: Split from and expires field in dst_entry out of union [net-next] Neil Horman
2013-02-19 21:17 ` Eric Dumazet
2013-02-19 21:49 ` Neil Horman
2013-02-19 21:55 ` Eric Dumazet [this message]
2013-02-20 6:33 ` Gao feng
2013-02-20 7:00 ` Eric Dumazet
2013-02-20 9:31 ` Gao feng
2013-02-20 10:02 ` YOSHIFUJI Hideaki
2013-02-20 10:17 ` [PATCH] ipv6: fix race condition regarding dst->expires and dst->from YOSHIFUJI Hideaki
2013-02-20 10:25 ` YOSHIFUJI Hideaki
2013-02-20 10:29 ` [PATCH V2] " YOSHIFUJI Hideaki
2013-02-20 16:12 ` Eric Dumazet
2013-02-20 16:34 ` Neil Horman
2013-02-20 20:12 ` David Miller
2013-02-20 10:55 ` [RFC PATCH] ipv6: Split from and expires field in dst_entry out of union [net-next] David Laight
2013-02-20 12:02 ` Neil Horman
2013-02-20 12:08 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1361310958.19353.164.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=gaofeng@cn.fujitsu.com \
--cc=jbohac@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox