diff options
author | Florent Fourcot <florent.fourcot@enst-bretagne.fr> | 2013-11-07 17:53:14 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-11-08 13:44:15 -0500 |
commit | 394055f6fabd077e74815865f01a73a31dd765d3 (patch) | |
tree | f662d2d1206ef88cc47e97ac01d2f6f3dc6b8a67 /net/ipv6/ip6_flowlabel.c | |
parent | 53b47106c0c2b1f42237d255ae272f0fcc3ec413 (diff) |
ipv6: protect flow label renew against GC
Take ip6_fl_lock before to read and update
a label.
v2: protect only the relevant code
Reported-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Florent Fourcot <florent.fourcot@enst-bretagne.fr>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_flowlabel.c')
-rw-r--r-- | net/ipv6/ip6_flowlabel.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 5f10b0d0bca..98fdcc6f51b 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c @@ -345,6 +345,8 @@ static int fl6_renew(struct ip6_flowlabel *fl, unsigned long linger, unsigned lo expires = check_linger(expires); if (!expires) return -EPERM; + + spin_lock_bh(&ip6_fl_lock); fl->lastuse = jiffies; if (time_before(fl->linger, linger)) fl->linger = linger; @@ -352,6 +354,8 @@ static int fl6_renew(struct ip6_flowlabel *fl, unsigned long linger, unsigned lo expires = fl->linger; if (time_before(fl->expires, fl->lastuse + expires)) fl->expires = fl->lastuse + expires; + spin_unlock_bh(&ip6_fl_lock); + return 0; } |