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.1104072131050.1538@swampdragon.chaosbits.net>
Date:	Thu, 7 Apr 2011 21:34:30 +0200 (CEST)
From:	Jesper Juhl <jj@...osbits.net>
To:	Mauro Carvalho Chehab <mchehab@...radead.org>
cc:	linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
	Dan Carpenter <error27@...il.com>,
	Olivier Grenie <olivier.grenie@...com.fr>,
	Patrick Boettcher <patrick.boettcher@...com.fr>
Subject: [PATCH][media] DVB, DiB9000: Fix leak in dib9000_attach()

If the second memory allocation in dib9000_attach() fails, we'll leak the 
memory allocated by the first.

Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
 dib9000.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

   compile tested only...

diff --git a/drivers/media/dvb/frontends/dib9000.c b/drivers/media/dvb/frontends/dib9000.c
index 9151876..b25ef2b 100644
--- a/drivers/media/dvb/frontends/dib9000.c
+++ b/drivers/media/dvb/frontends/dib9000.c
@@ -2255,8 +2255,10 @@ struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, c
 	if (st == NULL)
 		return NULL;
 	fe = kzalloc(sizeof(struct dvb_frontend), GFP_KERNEL);
-	if (fe == NULL)
+	if (fe == NULL) {
+		kfree(st);
 		return NULL;
+	}
 
 	memcpy(&st->chip.d9.cfg, cfg, sizeof(struct dib9000_config));
 	st->i2c.i2c_adap = i2c_adap;


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