From 6901050586b6c4a5b752ec1abd795434e7b9d11a Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso Date: Sat, 23 Feb 2019 09:44:43 +0800 Subject: [PATCH] fs/epoll: robustify ep->mtx held checks mainline inclusion from mainline-5.0-rc1 commit 21877e1a5b520132f54515f8835c963056418b4c category: bugfix bugzilla: 10119 CVE: NA --------------------------- Insted of just commenting how important it is, lets make it more robust and add a lockdep_assert_held() call. Link: http://lkml.kernel.org/r/20181108051006.18751-5-dave@stgolabs.net Signed-off-by: Davidlohr Bueso Reviewed-by: Andrew Morton Cc: Al Viro Cc: Jason Baron Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: zhengbin Reviewed-by: Hou Tao Signed-off-by: Yang Yingliang --- fs/eventpoll.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 9bb3c7f050eb..113730881f11 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1638,6 +1638,8 @@ static __poll_t ep_send_events_proc(struct eventpoll *ep, struct list_head *head * Items cannot vanish during the loop because ep_scan_ready_list() is * holding "mtx" during this call. */ + lockdep_assert_held(&ep->mtx); + for (esed->res = 0, uevent = esed->events; !list_empty(head) && esed->res < esed->maxevents;) { epi = list_first_entry(head, struct epitem, rdllink); -- GitLab