Message ID | BANLkTinQAy+jq_VUwky2rxchomuN3avPQg@mail.gmail.com |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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) { + list_del_rcu(&pos->list); + call_rcu(&pos->rcu, sctp_local_addr_free); SCTP_DBG_OBJCNT_DEC(addr); } }