OSDN Git Service

[media] rc: double unlock in rc_register_device()
authorDan Carpenter <error27@gmail.com>
Thu, 26 May 2011 08:52:01 +0000 (05:52 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 27 Jul 2011 20:52:24 +0000 (17:52 -0300)
If change_protocol() fails and we goto out_raw, then it calls unlock
twice.  I noticed that the other time we called change_protocol() we
held the &dev->lock, so I changed it to hold it here too.

Reviewed-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/rc/rc-main.c

index 3186ac7..30634ab 100644 (file)
@@ -1099,7 +1099,6 @@ int rc_register_device(struct rc_dev *dev)
                if (rc < 0)
                        goto out_input;
        }
-       mutex_unlock(&dev->lock);
 
        if (dev->change_protocol) {
                rc = dev->change_protocol(dev, rc_map->rc_type);
@@ -1107,6 +1106,8 @@ int rc_register_device(struct rc_dev *dev)
                        goto out_raw;
        }
 
+       mutex_unlock(&dev->lock);
+
        IR_dprintk(1, "Registered rc%ld (driver: %s, remote: %s, mode %s)\n",
                   dev->devno,
                   dev->driver_name ? dev->driver_name : "unknown",