video/fb: fix pollnotify calling crash in advance

When executing up_fbinitialize, the driver may turn on the vsync interrupt. If the vsync interrupt calls fb_pollnotify before executing fb->vtable->priv = fb it will cause null pointer access and crash.

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
pengyiqiang 2023-04-26 13:22:49 +08:00 committed by Alin Jerpelea
parent 50a8ec62c4
commit 0939634b42

View File

@ -803,6 +803,13 @@ void fb_pollnotify(FAR struct fb_vtable_s *vtable)
fb = vtable->priv; fb = vtable->priv;
/* Prevent calling before getting the vtable. */
if (fb == NULL)
{
return;
}
if (fb->vsyncoffset > 0) if (fb->vsyncoffset > 0)
{ {
wd_start(&fb->wdog, fb->vsyncoffset, fb_do_pollnotify, (wdparm_t)fb); wd_start(&fb->wdog, fb->vsyncoffset, fb_do_pollnotify, (wdparm_t)fb);