Skip to content

Commit ad537b8

Browse files
brgllinusw
authored andcommitted
gpiolib: fix filtering out unwanted events
GPIOEVENT_REQUEST_BOTH_EDGES is not a single flag, but a binary OR of GPIOEVENT_REQUEST_RISING_EDGE and GPIOEVENT_REQUEST_FALLING_EDGE. The expression 'le->eflags & GPIOEVENT_REQUEST_BOTH_EDGES' we'll get evaluated to true even if only one event type was requested. Fix it by checking both RISING & FALLING flags explicitly. Cc: stable@vger.kernel.org Fixes: 61f922d ("gpio: userspace ABI for reading GPIO line events") Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent c0bc126 commit ad537b8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpio/gpiolib.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,8 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p)
708708

709709
ge.timestamp = ktime_get_real_ns();
710710

711-
if (le->eflags & GPIOEVENT_REQUEST_BOTH_EDGES) {
711+
if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE
712+
&& le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) {
712713
int level = gpiod_get_value_cansleep(le->desc);
713714

714715
if (level)

0 commit comments

Comments
 (0)