summaryrefslogtreecommitdiff
path: root/net/ipv6/ip6_flowlabel.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2019-07-03 11:50:21 +0300
committerThomas Gleixner <tglx@linutronix.de>2019-07-03 11:50:21 +0300
commit341924049558e5f7c1a148a2c461a417933d35d9 (patch)
tree1340b4f2131737ef4be63f18ee74cd73ad12cd3e /net/ipv6/ip6_flowlabel.c
parent516337048fa40496ae5ca9863c367ec991a44d9a (diff)
parent4a8f81b8c053aad250ee247b219904ada72df9a4 (diff)
downloadlinux-341924049558e5f7c1a148a2c461a417933d35d9.tar.xz
Merge branch 'timers/vdso' into timers/core
so the hyper-v clocksource update can be applied.
Diffstat (limited to 'net/ipv6/ip6_flowlabel.c')
-rw-r--r--net/ipv6/ip6_flowlabel.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 2f3eb7dc45da..545e339b8c4f 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -250,9 +250,9 @@ struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label)
rcu_read_lock_bh();
for_each_sk_fl_rcu(np, sfl) {
struct ip6_flowlabel *fl = sfl->fl;
- if (fl->label == label) {
+
+ if (fl->label == label && atomic_inc_not_zero(&fl->users)) {
fl->lastuse = jiffies;
- atomic_inc(&fl->users);
rcu_read_unlock_bh();
return fl;
}
@@ -618,7 +618,8 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
goto done;
}
fl1 = sfl->fl;
- atomic_inc(&fl1->users);
+ if (!atomic_inc_not_zero(&fl1->users))
+ fl1 = NULL;
break;
}
}