Skip to content

Commit 0939634

Browse files
pengyiqiangjerpelea
authored andcommitted
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 <[email protected]>
1 parent 50a8ec6 commit 0939634

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/video/fb.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,13 @@ void fb_pollnotify(FAR struct fb_vtable_s *vtable)
803803

804804
fb = vtable->priv;
805805

806+
/* Prevent calling before getting the vtable. */
807+
808+
if (fb == NULL)
809+
{
810+
return;
811+
}
812+
806813
if (fb->vsyncoffset > 0)
807814
{
808815
wd_start(&fb->wdog, fb->vsyncoffset, fb_do_pollnotify, (wdparm_t)fb);

0 commit comments

Comments
 (0)