Skip to content

Commit 9694760

Browse files
Gary-Hobsonxiaoxiang781216
authored andcommitted
input: fix touchevent race condition
In touch_event, circbuf is operated, and there is a lack of protection here. Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
1 parent 272248d commit 9694760

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/input/touchscreen_upper.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ static void touch_event_notify(FAR struct touch_openpriv_s *openpriv,
375375
{
376376
int semcount;
377377

378+
nxmutex_lock(&openpriv->lock);
378379
circbuf_overwrite(&openpriv->circbuf, sample,
379380
SIZEOF_TOUCH_SAMPLE_S(sample->npoints));
380381

@@ -385,6 +386,7 @@ static void touch_event_notify(FAR struct touch_openpriv_s *openpriv,
385386
}
386387

387388
poll_notify(&openpriv->fds, 1, POLLIN);
389+
nxmutex_unlock(&openpriv->lock);
388390
}
389391

390392
/****************************************************************************

0 commit comments

Comments
 (0)