diff options
author | YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> | 2013-01-30 10:26:42 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-31 04:41:12 +0100 |
commit | f256dc59d0729cf7d371b93062375d9bc79c1e44 (patch) | |
tree | 59625bb29b227292b4fe2265f07147af35f9c560 /net/ipv6 | |
parent | x86: bpf_jit_comp: add pkt_type support (diff) | |
download | linux-f256dc59d0729cf7d371b93062375d9bc79c1e44.tar.xz linux-f256dc59d0729cf7d371b93062375d9bc79c1e44.zip |
ipv6 flowlabel: Ensure to take lock when modifying np->ip6_sk_fl_list.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/ip6_flowlabel.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 29124b7a04c8..5d767f1b8780 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c @@ -255,10 +255,19 @@ void fl6_free_socklist(struct sock *sk) struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_fl_socklist *sfl; - while ((sfl = np->ipv6_fl_list) != NULL) { - np->ipv6_fl_list = sfl->next; + if (!np->ipv6_fl_list) + return; + + write_lock_bh(&ipv6_sk_fl_lock); + sfl = np->ipv6_fl_list; + np->ipv6_fl_list = NULL; + write_unlock_bh(&ipv6_sk_fl_lock); + + while (sfl) { + struct ipv6_fl_socklist *next = sfl->next; fl_release(sfl->fl); kfree(sfl); + sfl = next; } } |