]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: media-request: fix epoll() by calling poll_wait first
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Thu, 7 Feb 2019 11:49:42 +0000 (06:49 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 18 Feb 2019 19:45:33 +0000 (14:45 -0500)
The epoll function expects that whenever the poll file op is
called, the poll_wait function is also called. That didn't
always happen in media_request_poll(). Fix this, otherwise
epoll() would timeout when it shouldn't.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/media-request.c

index c71a34ae6383c65651bd08baa8de0e5e59e59e9c..eec2e2b2f6eca53a3eb29c1129bf0bf481b831ad 100644 (file)
@@ -100,6 +100,7 @@ static __poll_t media_request_poll(struct file *filp,
        if (!(poll_requested_events(wait) & EPOLLPRI))
                return 0;
 
+       poll_wait(filp, &req->poll_wait, wait);
        spin_lock_irqsave(&req->lock, flags);
        if (req->state == MEDIA_REQUEST_STATE_COMPLETE) {
                ret = EPOLLPRI;
@@ -110,8 +111,6 @@ static __poll_t media_request_poll(struct file *filp,
                goto unlock;
        }
 
-       poll_wait(filp, &req->poll_wait, wait);
-
 unlock:
        spin_unlock_irqrestore(&req->lock, flags);
        return ret;