drm/msm: don't deref error pointer in the msm_fbdev_create error path
PATCH 1/1 drm/msm: don't deref error pointer in the msm_fbdev_create error path
From: Emil Velikov <[email protected]>
Currently the error pointer returned by msm_alloc_stolen_fb gets passed to drm_framebuffer_remove. The latter handles only NULL pointers, thus a nasty crash will occur.
Drop the unnecessary fail label and the associated checks - both err and fb will be set at this stage.
--- drivers/gpu/drm/msm/msm_fbdev.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/msm_fbdev.c +2 -7
@@ -92,8 +92,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,if (IS_ERR (fb)) {dev_err (dev->dev,"failed to allocate fb\n" ); - ret =PTR_ERR (fb); - goto fail; +return PTR_ERR (fb); } bo =msm_framebuffer_bo (fb,0 );
@@ -153,11 +152,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,mutex_unlock (&dev->struct_mutex); fail: -if (ret) { -if (fb) -drm_framebuffer_remove (fb); - } - +drm_framebuffer_remove (fb);return ret; }
Signature · 6 lines
2.16.0 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
A message that is not in the archive (sent off-list or not yet received): 20180328155347.7472-1-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH v2 1/1 drm/msm: don't deref error pointer in the msm_fbdev_create error path
From: Emil Velikov <[email protected]>
Currently the error pointer returned by msm_alloc_stolen_fb gets passed to drm_framebuffer_remove. The latter handles only NULL pointers, thus a nasty crash will occur.
Drop the unnecessary fail label and the associated checks - both err and fb will be set at this stage.
---
v2: really remove the fail label :-\
--- drivers/gpu/drm/msm/msm_fbdev.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/msm_fbdev.c +2 -9
@@ -92,8 +92,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,if (IS_ERR (fb)) {dev_err (dev->dev,"failed to allocate fb\n" ); - ret =PTR_ERR (fb); - goto fail; +return PTR_ERR (fb); } bo =msm_framebuffer_bo (fb,0 );
@@ -151,13 +150,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, fail_unlock:mutex_unlock (&dev->struct_mutex); -fail: - -if (ret) { -if (fb) -drm_framebuffer_remove (fb); - } - +drm_framebuffer_remove (fb);return ret; }
Signature · 6 lines
2.16.0 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
A message that is not in the archive (sent off-list or not yet received): 20180328162216.8595-1-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 9 lines · Emil Velikov
From: Emil Velikov <[email protected]>
Currently the error pointer returned by
msm_alloc_stolen_fbgets passed todrm_framebuffer_remove. The latter handles only NULL pointers, thus a nasty crash will occur.Drop the unnecessary fail label and the associated checks - both err and fb will be set at this stage.
Quoted 8 lines
Cc Rob Clark <[email protected]>Signed-off-by Emil Velikov <[email protected]>---
v2: really remove the fail label :-\
---
Humble ping?
-Emil
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno