[PATCH 1/1] Staging: lirc, fix double unlock
Jiri Slaby
jslaby at suse.cz
Sat Sep 4 12:02:49 UTC 2010
There is a missing return or goto statement in ine fail path in
sasem_probe, so that the code contiues its normal execution (and
unlocks a mutex twice). Fix that by jumping to the right place.
Anyway the code is very broken on its fail paths and there are many
leaks. But that's a different story.
Signed-off-by: Jiri Slaby <jslaby at suse.cz>
Cc: Jarod Wilson <jarod at redhat.com>
Cc: Mauro Carvalho Chehab <mchehab at redhat.com>
---
drivers/staging/lirc/lirc_sasem.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/lirc/lirc_sasem.c b/drivers/staging/lirc/lirc_sasem.c
index 73166c3..b496ff1 100644
--- a/drivers/staging/lirc/lirc_sasem.c
+++ b/drivers/staging/lirc/lirc_sasem.c
@@ -803,7 +803,8 @@ static int sasem_probe(struct usb_interface *interface,
if (lirc_minor < 0) {
err("%s: lirc_register_driver failed", __func__);
alloc_status = 7;
- mutex_unlock(&context->ctx_lock);
+ retval = lirc_minor;
+ goto unlock;
} else
printk(KERN_INFO "%s: Registered Sasem driver (minor:%d)\n",
__func__, lirc_minor);
@@ -859,7 +860,7 @@ alloc_status_switch:
printk(KERN_INFO "%s: Sasem device on usb<%d:%d> initialized\n",
__func__, dev->bus->busnum, dev->devnum);
-
+unlock:
mutex_unlock(&context->ctx_lock);
exit:
return retval;
--
1.7.2.2
More information about the devel
mailing list