lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1249030558-24143-5-git-send-email-dfeng@redhat.com>
Date:	Fri, 31 Jul 2009 16:55:58 +0800
From:	Xiaotian Feng <dfeng@...hat.com>
To:	airlied@...ux.ie, dri-devel@...ts.sourceforge.net
Cc:	linux-kernel@...r.kernel.org, Xiaotian Feng <dfeng@...hat.com>
Subject: [PATCH 4/4] gpu/drm: fix memory leak if dev->driver->load fails

Noticed a bundle of memory leaks after radeon_driver_load_kms fails.
After dev->driver->load failes, drm_get_dev doesn't free memories
allocated from drm_fill_in_dev.

Signed-off-by: Xiaotian Feng <dfeng@...hat.com>
---
 drivers/gpu/drm/drm_stub.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index fe7f5c4..db9057c 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -448,23 +448,23 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
 		pci_set_drvdata(pdev, dev);
 		ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL);
 		if (ret)
-			goto err_g2;
+			goto err_g3;
 	}
 
 	if ((ret = drm_get_minor(dev, &dev->primary, DRM_MINOR_LEGACY)))
-		goto err_g3;
+		goto err_g4;
 
 	if (dev->driver->load) {
 		ret = dev->driver->load(dev, ent->driver_data);
 		if (ret)
-			goto err_g4;
+			goto err_g5;
 	}
 
         /* setup the grouping for the legacy output */
 	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
 		ret = drm_mode_group_init_legacy_group(dev, &dev->primary->mode_group);
 		if (ret)
-			goto err_g4;
+			goto err_g5;
 	}
 
 	list_add_tail(&dev->driver_item, &driver->device_list);
@@ -475,11 +475,13 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
 
 	return 0;
 
-err_g4:
+err_g5:
 	drm_put_minor(&dev->primary);
-err_g3:
+err_g4:
 	if (drm_core_check_feature(dev, DRIVER_MODESET))
 		drm_put_minor(&dev->control);
+err_g3:
+	drm_cleanup_dev(dev);
 err_g2:
 	pci_disable_device(pdev);
 err_g1:
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ