[media] dvb: unlock on error in dvb_ca_en50221_io_do_ioctl()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 4 Jan 2013 17:56:02 +0000 (14:56 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 6 Jan 2013 12:44:45 +0000 (10:44 -0200)
We recently pushed the locking down into this function, but there was
an error path where the unlock was missed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb-core/dvb_ca_en50221.c

index 190e5e0f48c76ef106c144537318c06eb2f0c9e3..0aac3096728ee1faafa49a2ca8ad0986d18b0158 100644 (file)
@@ -1227,8 +1227,10 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file,
        case CA_GET_SLOT_INFO: {
                struct ca_slot_info *info = parg;
 
-               if ((info->num > ca->slot_count) || (info->num < 0))
-                       return -EINVAL;
+               if ((info->num > ca->slot_count) || (info->num < 0)) {
+                       err = -EINVAL;
+                       goto out_unlock;
+               }
 
                info->type = CA_CI_LINK;
                info->flags = 0;
@@ -1247,6 +1249,7 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file,
                break;
        }
 
+out_unlock:
        mutex_unlock(&ca->ioctl_mutex);
        return err;
 }