Use SLIST_FOREACH_SAFE() macro, because knote_drop() can free an element

which can be then used to find next element in the list.

OK'ed by:	jmg
This commit is contained in:
Pawel Jakub Dawidek 2006-06-02 13:18:59 +00:00
parent b19bfd3db5
commit 241321abc0

View File

@ -1708,7 +1708,7 @@ knlist_destroy(struct knlist *knl)
void
knlist_cleardel(struct knlist *knl, struct thread *td, int islocked, int killkn)
{
struct knote *kn;
struct knote *kn, *kn2;
struct kqueue *kq;
if (islocked)
@ -1719,7 +1719,7 @@ knlist_cleardel(struct knlist *knl, struct thread *td, int islocked, int killkn)
knl->kl_lock(knl->kl_lockarg);
}
SLIST_FOREACH(kn, &knl->kl_list, kn_selnext) {
SLIST_FOREACH_SAFE(kn, &knl->kl_list, kn_selnext, kn2) {
kq = kn->kn_kq;
KQ_LOCK(kq);
if ((kn->kn_status & KN_INFLUX)) {