Commit 394055f6 authored by Florent Fourcot's avatar Florent Fourcot Committed by David S. Miller

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: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarFlorent Fourcot <florent.fourcot@enst-bretagne.fr>
Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 53b47106
...@@ -345,6 +345,8 @@ static int fl6_renew(struct ip6_flowlabel *fl, unsigned long linger, unsigned lo ...@@ -345,6 +345,8 @@ static int fl6_renew(struct ip6_flowlabel *fl, unsigned long linger, unsigned lo
expires = check_linger(expires); expires = check_linger(expires);
if (!expires) if (!expires)
return -EPERM; return -EPERM;
spin_lock_bh(&ip6_fl_lock);
fl->lastuse = jiffies; fl->lastuse = jiffies;
if (time_before(fl->linger, linger)) if (time_before(fl->linger, linger))
fl->linger = linger; fl->linger = linger;
...@@ -352,6 +354,8 @@ static int fl6_renew(struct ip6_flowlabel *fl, unsigned long linger, unsigned lo ...@@ -352,6 +354,8 @@ static int fl6_renew(struct ip6_flowlabel *fl, unsigned long linger, unsigned lo
expires = fl->linger; expires = fl->linger;
if (time_before(fl->expires, fl->lastuse + expires)) if (time_before(fl->expires, fl->lastuse + expires))
fl->expires = fl->lastuse + expires; fl->expires = fl->lastuse + expires;
spin_unlock_bh(&ip6_fl_lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment