diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-12-07 10:41:17 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-12-07 10:41:17 -0800 |
commit | ad910e36da4ca3a1bd436989f632d062dda0c921 (patch) | |
tree | 602909bcdadd7b61ea2dbca372db6ec3a81bc3b8 /sound/usb | |
parent | eea2d5da29e396b6cc1fb35e36bcbf5f57731015 (diff) |
pipe: fix poll/select race introduced by the pipe rework
The kernel wait queues have a basic rule to them: you add yourself to
the wait-queue first, and then you check the things that you're going to
wait on. That avoids the races with the event you're waiting for.
The same goes for poll/select logic: the "poll_wait()" goes first, and
then you check the things you're polling for.
Of course, if you use locking, the ordering doesn't matter since the
lock will serialize with anything that changes the state you're looking
at. That's not the case here, though.
So move the poll_wait() first in pipe_poll(), before you start looking
at the pipe state.
Fixes: 8cefc107ca54 ("pipe: Use head and tail pointers for the ring, not cursor and length")
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'sound/usb')
0 files changed, 0 insertions, 0 deletions