mbox series

[libgpiod,0/2] fix potential discarding of events by read events

Message ID 20200912022248.16240-1-warthog618@gmail.com
Headers show
Series fix potential discarding of events by read events | expand

Message

Kent Gibson Sept. 12, 2020, 2:22 a.m. UTC
This patch set addresses a bug where reading events can quietly discard
events.  The problem occurs any time a request made is for a number of
events that differs from the number available at the time - a number
that userspace is unaware of.

The problem is due to the read multiple always reading up to 16 events
from the kernel - independent of how many events have been requested.

The problem applies to reading both single and multiple events, as the
single event read implementation wraps the multiple.

The first patch extends test coverage to highlight the problem.
The second fixes the bug.

Kent Gibson (2):
  tests: event: reading test coverage extended to cover reading a subset
    of available events
  core: fix reading subset of available events

 lib/core.c          |   5 +-
 tests/tests-event.c | 144 ++++++++++++++++++++++++++++++++++++++------
 2 files changed, 128 insertions(+), 21 deletions(-)


base-commit: fc61e740fcbe3c6594295766759888c96c45bd29