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>
This commit is contained in:
yinshengkai 2024-08-22 21:06:40 +08:00 committed by Xiang Xiao
parent 272248de37
commit 9694760eb8
1 changed files with 2 additions and 0 deletions

View File

@ -375,6 +375,7 @@ static void touch_event_notify(FAR struct touch_openpriv_s *openpriv,
{
int semcount;
nxmutex_lock(&openpriv->lock);
circbuf_overwrite(&openpriv->circbuf, sample,
SIZEOF_TOUCH_SAMPLE_S(sample->npoints));
@ -385,6 +386,7 @@ static void touch_event_notify(FAR struct touch_openpriv_s *openpriv,
}
poll_notify(&openpriv->fds, 1, POLLIN);
nxmutex_unlock(&openpriv->lock);
}
/****************************************************************************