[patch] potential race in epoll_ctl(EPOLL_CTL_MOD) ...

From: Davide Libenzi
Date: Fri Feb 13 2004 - 18:47:40 EST



Andrew, a potential race can happen in epoll_ctl(EPOLL_CTL_MOD) where an
event can happen in between f_op->poll() and the lock on ep->lock (we
cannot call f_op->poll() inside a lock, and the f_op->poll() callback does
not carry any info at the current time - missing wake_up_info() already ;).
In that case the event would be removed. We can easily leave the event
inside the ready list and have the ep_send_events() logic do the job for
us at later time.
(Thanks to david.lee@xxxxxxxxxxxx for reporting the thing, since it
shouldn't have been a nice one ;)



- Davide




--- a/fs/eventpoll.c 2004-02-13 14:13:29.417933600 -0800
+++ b/fs/eventpoll.c 2004-02-13 14:13:46.999260832 -0800
@@ -1155,8 +1155,7 @@
if (waitqueue_active(&ep->poll_wait))
pwake++;
}
- } else if (EP_IS_LINKED(&epi->rdllink))
- EP_LIST_DEL(&epi->rdllink);
+ }
}

write_unlock_irqrestore(&ep->lock, flags);







-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/