mbox series

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

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

Message

Kent Gibson Sept. 12, 2020, 8:11 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.

Changes for v2:
 - restored usleep() when creating multiple events in patch 1.

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 | 157 ++++++++++++++++++++++++++++++++++++++------
 2 files changed, 141 insertions(+), 21 deletions(-)


base-commit: fc61e740fcbe3c6594295766759888c96c45bd29