drm/nouveau: fix some error-path leaks in fbcon handling code
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
060810d7ab
commit
fdfb833265
|
@ -138,7 +138,7 @@ nouveau_user_framebuffer_create(struct drm_device *dev,
|
|||
{
|
||||
struct nouveau_framebuffer *nouveau_fb;
|
||||
struct drm_gem_object *gem;
|
||||
int ret;
|
||||
int ret = -ENOMEM;
|
||||
|
||||
gem = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]);
|
||||
if (!gem)
|
||||
|
@ -146,15 +146,19 @@ nouveau_user_framebuffer_create(struct drm_device *dev,
|
|||
|
||||
nouveau_fb = kzalloc(sizeof(struct nouveau_framebuffer), GFP_KERNEL);
|
||||
if (!nouveau_fb)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
goto err_unref;
|
||||
|
||||
ret = nouveau_framebuffer_init(dev, nouveau_fb, mode_cmd, nouveau_gem_object(gem));
|
||||
if (ret) {
|
||||
drm_gem_object_unreference(gem);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
return &nouveau_fb->base;
|
||||
|
||||
err:
|
||||
kfree(nouveau_fb);
|
||||
err_unref:
|
||||
drm_gem_object_unreference(gem);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
static const struct drm_mode_config_funcs nouveau_mode_config_funcs = {
|
||||
|
|
|
@ -385,6 +385,7 @@ out_unlock:
|
|||
mutex_unlock(&dev->struct_mutex);
|
||||
if (chan)
|
||||
nouveau_bo_vma_del(nvbo, &fbcon->nouveau_fb.vma);
|
||||
nouveau_bo_unmap(nvbo);
|
||||
out_unpin:
|
||||
nouveau_bo_unpin(nvbo);
|
||||
out_unref:
|
||||
|
|
Loading…
Reference in New Issue