[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1107282345540.20477@swampdragon.chaosbits.net>
Date: Thu, 28 Jul 2011 23:49:51 +0200 (CEST)
From: Jesper Juhl <jj@...osbits.net>
To: linux-kernel@...r.kernel.org
cc: Jarod Wilson <jarod@...sonet.com>,
Greg Kroah-Hartman <gregkh@...e.de>,
Mauro Carvalho Chehab <mchehab@...hat.com>,
Andy Walls <awalls@...metrocast.net>,
devel@...verdev.osuosl.org,
Gerd Knorr <kraxel@...dbach.in-berlin.de>,
Michal Kochanowicz <mkochano@....org.pl>,
Christoph Bartelmus <lirc@...telmus.de>,
Ulrich Mueller <ulrich.mueller42@....de>,
Stefan Jahn <stefan@...c.org>,
Jerome Brock <jbrock@...rs.sourceforge.net>,
Thomas Reitmayr <treitmayr@...oo.com>,
Mark Weaver <mark@...l.co.uk>, Jarod Wilson <jarod@...hat.com>
Subject: [PATCH] staging; lirc, zilog: put_ir_rx may free 'rx' which can lead
to double free
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.
To fix this, test the return value of 'put_ir_rx()' and if it is true
(1), zero 'rx' so that we won't do it again.
I'm not familiar with this code, so this may not be the best fix, and
I also don't have the hardware to test it properly, so this patch is
compile tested only and someone who knows this code should probably
ACK it before it's merged.
Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
drivers/staging/lirc/lirc_zilog.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c
index 0302d82..51ded22 100644
--- a/drivers/staging/lirc/lirc_zilog.c
+++ b/drivers/staging/lirc/lirc_zilog.c
@@ -1577,7 +1577,8 @@ 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);
+ if (put_ir_rx(rx, true))
+ rx = NULL;
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