diff mbox

[net-next,v2,3/3] ipv6: protect flow label renew against GC

Message ID 1383843194-22945-3-git-send-email-florent.fourcot@enst-bretagne.fr
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Florent Fourcot Nov. 7, 2013, 4:53 p.m. UTC
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>
---
 net/ipv6/ip6_flowlabel.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Hannes Frederic Sowa Nov. 8, 2013, 12:29 p.m. UTC | #1
On Thu, Nov 07, 2013 at 05:53:14PM +0100, Florent Fourcot wrote:
> 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>

Thanks for fixing this,

  Hannes

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Nov. 8, 2013, 6:44 p.m. UTC | #2
From: Florent Fourcot <florent.fourcot@enst-bretagne.fr>
Date: Thu,  7 Nov 2013 17:53:14 +0100

> 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>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
 }