From: YOSHIFUJI Hideaki / 吉藤英明 Date: Wed, 30 Jan 2013 09:26:42 +0000 (+0000) Subject: ipv6 flowlabel: Ensure to take lock when modifying np->ip6_sk_fl_list. X-Git-Tag: v5.15~20710^2~203 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f256dc59d0729cf7d371b93062375d9bc79c1e44;p=platform%2Fkernel%2Flinux-starfive.git ipv6 flowlabel: Ensure to take lock when modifying np->ip6_sk_fl_list. Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 29124b7..5d767f1 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; } }