* [PATCH net] ipv6: flowlabel: fl6_sock_lookup() must use atomic_inc_not_zero
@ 2019-06-06 21:22 Eric Dumazet
2019-06-06 21:27 ` Eric Dumazet
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2019-06-06 21:22 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet, Willem de Bruijn
RCU 101 : Before taking a refcount, make sure the object is not already
scheduled for deletion.
Fixes: 18367681a10b ("ipv6 flowlabel: Convert np->ipv6_fl_list to RCU.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
---
net/ipv6/ip6_flowlabel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index be5f3d7ceb966d609121f89a6cc5dcc605834c89..31dec1f00ad267b66449a42ab989236e9f7af5d9 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -254,9 +254,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;
}
--
2.22.0.rc1.311.g5d7573a151-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] ipv6: flowlabel: fl6_sock_lookup() must use atomic_inc_not_zero
2019-06-06 21:22 [PATCH net] ipv6: flowlabel: fl6_sock_lookup() must use atomic_inc_not_zero Eric Dumazet
@ 2019-06-06 21:27 ` Eric Dumazet
0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2019-06-06 21:27 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Willem de Bruijn
On Thu, Jun 6, 2019 at 2:22 PM Eric Dumazet <edumazet@google.com> wrote:
>
> RCU 101 : Before taking a refcount, make sure the object is not already
> scheduled for deletion.
>
I will send a V2, there is a second atomic_inc() which needs to be
changed in ipv6_flowlabel_opt()
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-06 21:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-06 21:22 [PATCH net] ipv6: flowlabel: fl6_sock_lookup() must use atomic_inc_not_zero Eric Dumazet
2019-06-06 21:27 ` Eric Dumazet
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.