forked from Minki/linux
drm/sun4i: Check return value of drm_vblank_init
drm_vblank_init can fail due to insufficient memory. Ignoring the error and proceeding may cause the kernel to dereference an invalid pointer when vblank is enabled. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
This commit is contained in:
parent
9d56defb44
commit
92b300c4e6
@ -102,7 +102,11 @@ static int sun4i_drv_bind(struct device *dev)
|
|||||||
}
|
}
|
||||||
drm->dev_private = drv;
|
drm->dev_private = drv;
|
||||||
|
|
||||||
drm_vblank_init(drm, 1);
|
/* drm_vblank_init calls kcalloc, which can fail */
|
||||||
|
ret = drm_vblank_init(drm, 1);
|
||||||
|
if (ret)
|
||||||
|
goto free_drm;
|
||||||
|
|
||||||
drm_mode_config_init(drm);
|
drm_mode_config_init(drm);
|
||||||
|
|
||||||
ret = component_bind_all(drm->dev, drm);
|
ret = component_bind_all(drm->dev, drm);
|
||||||
|
Loading…
Reference in New Issue
Block a user