[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1305723046.2991.19.camel@edumazet-laptop>
Date: Wed, 18 May 2011 14:50:46 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Jacek Luczak <difrost.kernel@...il.com>
Cc: Vladislav Yasevich <vladislav.yasevich@...com>,
Wei Yongjun <yjwei@...fujitsu.com>, netdev@...r.kernel.org
Subject: Re: [PATCH] SCTP: fix race between sctp_bind_addr_free() and
sctp_bind_addr_conflict()
Le mercredi 18 mai 2011 à 14:47 +0200, Jacek Luczak a écrit :
> OK then, at the end what Eric suggested is IMO valid:
>
> diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
> index faf71d1..0025d90 100644
> --- a/net/sctp/bind_addr.c
> +++ b/net/sctp/bind_addr.c
> @@ -144,10 +144,9 @@ static void sctp_bind_addr_clean(struct sctp_bind_addr *bp)
> struct list_head *pos, *temp;
>
> /* Empty the bind address list. */
> - list_for_each_safe(pos, temp, &bp->address_list) {
> - addr = list_entry(pos, struct sctp_sockaddr_entry, list);
> - list_del(pos);
> - kfree(addr);
> + list_for_each_entry(pos, &bp->address_list, list) {
a 'safe' version is needed here, since we remove items in iterator.
> + list_del_rcu(&pos->list);
> + call_rcu(&pos->rcu, sctp_local_addr_free);
> SCTP_DBG_OBJCNT_DEC(addr);
> }
> }
>
>
> I will test this. Should be safe, avoid race not only in that case and
> it consistent.
>
> -Jacek
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists