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] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 29 Jul 2011 11:14:57 +0200 (CEST)
From:	Jesper Juhl <jj@...osbits.net>
To:	Dan Carpenter <error27@...il.com>
cc:	linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org,
	Jarod Wilson <jarod@...hat.com>,
	Jerome Brock <jbrock@...rs.sourceforge.net>,
	Andy Walls <awalls@...metrocast.net>,
	Mauro Carvalho Chehab <mchehab@...hat.com>,
	Gerd Knorr <kraxel@...dbach.in-berlin.de>,
	Jarod Wilson <jarod@...sonet.com>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	Thomas Reitmayr <treitmayr@...oo.com>,
	Michal Kochanowicz <mkochano@....org.pl>,
	Christoph Bartelmus <lirc@...telmus.de>,
	Mark Weaver <mark@...l.co.uk>,
	Ulrich Mueller <ulrich.mueller42@....de>,
	Stefan Jahn <stefan@...c.org>
Subject: Re: [PATCH] staging; lirc, zilog: put_ir_rx may free 'rx' which can
 lead to double free

On Fri, 29 Jul 2011, Dan Carpenter wrote:

> On Thu, Jul 28, 2011 at 11:49:51PM +0200, Jesper Juhl wrote:
> > If calling put_ir_rx(rx, true); in
> > drivers/staging/lirc/lirc_zilog.c::ir_probe() returns true (1) then it
> > means that it has freed it's first argument. Subsequently jumping to
> > 'out_put_xx' will cause us to call put_ir_rx() once more since 'rx' is
> > not zero - leading to a double free.
> 
> It would be better to just remove the first call to put_ir_rx().
> 

Taking a second look... Yes, you are right, that would be just fine and a 
lot simpler. Thanks for reviewing.

Here's an updated patch.


From: Jesper Juhl <jj@...osbits.net>
Subject: [PATCH] staging; lirc, zilog: put_ir_rx may free 'rx' which can lead to double free

If the call to put_ir_rx(rx, true); in
drivers/staging/lirc/lirc_zilog.c::ir_probe() returns true (1) then it
means that it has freed it's first argument. Subsequently jumping to
'out_put_xx' will cause us to call put_ir_rx() once more since 'rx' is
not zero - leading to a double free.
To fix this, simply remove the first call to put_ir_rx().

Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
 drivers/staging/lirc/lirc_zilog.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c
index 0302d82..6be6f67 100644
--- a/drivers/staging/lirc/lirc_zilog.c
+++ b/drivers/staging/lirc/lirc_zilog.c
@@ -1577,7 +1577,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
 			put_ir_device(ir, true);
 			/* Failure exit, so put back rx ref from i2c_client */
 			i2c_set_clientdata(client, NULL);
-			put_ir_rx(rx, true);
 			ir->l.features &= ~LIRC_CAN_REC_LIRCCODE;
 			goto out_put_xx;
 		}
-- 
1.7.6

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