Skip to content

Commit

Permalink
ipv6 flowlabel: Ensure to take lock when modifying np->ip6_sk_fl_list.
Browse files Browse the repository at this point in the history
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
YOSHIFUJI Hideaki / 吉藤英明 authored and David S. Miller committed Jan 31, 2013
1 parent 3b58908 commit f256dc5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions net/ipv6/ip6_flowlabel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit f256dc5

Please sign in to comment.