ce88bc212d
From: Jussi Kivilinna <jussi.kivilinna@haltian.com> Date: Thu, 7 Dec 2017 13:00:14 +0200 Subject: [PATCH] drivers/pipes: poll: fix off-by-one error in calculation of bytes in the buffer Buffer calculation in pipe poll setup is off-by-one when read indexis larger than write index. This causes poll() not getting POLLINwhen buffer has one byte as calculation gives zero bytes in buffer. Reproducible with: { char buf[8] = { 0, }; int fds[2]; struct pollfd in_pfd; pipe2(fds, 8); write(fds[1], buf, 7); read(fds[0], buf, 7); write(fds[1], buf, 1); in_pfd.fd = fds[0]; in_pfd.events = POLLIN; ret = poll(&in_pfd, 1, -1); // pipe bug => stuck waiting assert(ret == 1); } |
||
---|---|---|
.. | ||
fifo.c | ||
Kconfig | ||
Make.defs | ||
pipe_common.c | ||
pipe_common.h | ||
pipe.c |