Skip to content

Commit

Permalink
drm: plug memory leak on drm_setup() failure
Browse files Browse the repository at this point in the history
Currently we fail to free and detach the drm_file when drm_setup() fails.
Use the drm_close_helper to do address that.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190114084410.15266-2-emil.l.velikov@gmail.com
  • Loading branch information
Emil Velikov authored and Emil Velikov committed Feb 13, 2019
1 parent e21710a commit 4acc5be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/drm_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,10 @@ int drm_open(struct inode *inode, struct file *filp)
goto err_undo;
if (need_setup) {
retcode = drm_setup(dev);
if (retcode)
if (retcode) {
drm_close_helper(filp);
goto err_undo;
}
}
return 0;

Expand Down

0 comments on commit 4acc5be

Please sign in to comment.