diff options
author | Lyude Paul <lyude@redhat.com> | 2018-08-22 21:40:06 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2018-10-11 09:54:10 +1000 |
commit | c4cee69a4497d9c6ad8868d63568b30e50cac9e9 (patch) | |
tree | a0cd5f3f571bcf560f08aa2d101b4126a833119d /drivers/gpu/drm/nouveau/nouveau_drm.c | |
parent | e15e4c13e5b77e8b8e8c5e6d23831b1180249788 (diff) | |
download | linux-c4cee69a4497d9c6ad8868d63568b30e50cac9e9.tar.bz2 |
drm/nouveau: Fix potential memory leak in nouveau_drm_load()
We forget to free drm in all instances of failure, and additionally also
forget to destroy the master client if the other client fails
initialization.
Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_drm.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 74d2283f2c28..905956809d21 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -538,11 +538,11 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) ret = nouveau_cli_init(drm, "DRM-master", &drm->master); if (ret) - return ret; + goto fail_alloc; ret = nouveau_cli_init(drm, "DRM", &drm->client); if (ret) - return ret; + goto fail_master; dev->irq_enabled = true; @@ -605,7 +605,9 @@ fail_bios: fail_ttm: nouveau_vga_fini(drm); nouveau_cli_fini(&drm->client); +fail_master: nouveau_cli_fini(&drm->master); +fail_alloc: kfree(drm); return ret; } |