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>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1207202039350.23164@swampdragon.chaosbits.net>
Date:	Fri, 20 Jul 2012 20:47:55 +0200 (CEST)
From:	Jesper Juhl <jj@...osbits.net>
To:	David Airlie <airlied@...ux.ie>
cc:	Adam Jackson <ajax@...hat.com>, Dave Airlie <airlied@...hat.com>,
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: [PATCH] drm, cirrus_fbdev: Fix leak in cirrusfb_create()

We have this code:

...
	sysram = vmalloc(size);
	if (!sysram)
		return -ENOMEM;

	info = framebuffer_alloc(0, device);
	if (info == NULL)
		return -ENOMEM;
...

If the vmalloc() call succeeds but the framebuffer_alloc() call
subsequently fails then we'll leak the memory allocated for 'sysram'
with vmalloc().

Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
 drivers/gpu/drm/cirrus/cirrus_fbdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
index 9a276a5..cdaa270 100644
--- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
+++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
@@ -155,8 +155,10 @@ static int cirrusfb_create(struct cirrus_fbdev *gfbdev,
 		return -ENOMEM;
 
 	info = framebuffer_alloc(0, device);
-	if (info == NULL)
+	if (!info) {
+		vfree(sysram);
 		return -ENOMEM;
+	}
 
 	info->par = gfbdev;
 
-- 
1.7.11.2


-- 
Jesper Juhl <jj@...osbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
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