From: Florent Fourcot Date: Thu, 7 Nov 2013 16:53:14 +0000 (+0100) Subject: ipv6: protect flow label renew against GC X-Git-Tag: accepted/tizen/common/20141203.182822~1141^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=394055f6fabd077e74815865f01a73a31dd765d3;p=platform%2Fkernel%2Flinux-arm64.git 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 Signed-off-by: Florent Fourcot Acked-by: Hannes Frederic Sowa Signed-off-by: David S. Miller --- diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 5f10b0d..98fdcc6 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; }