Skip to contentSkip to conversation

dvb: unlock on error in dvb_ca_en50221_io_do_ioctl()

PATCH In review Dan Carpenter 2 participants 2 messages Jan 4, 2013 – Jan 7, 2013 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 50e3bfe0.IJT/Tw4ZVUbERlpE%[email protected]

#1 lore raw

PATCH 1/1 dvb: unlock on error in dvb_ca_en50221_io_do_ioctl()

We recently pushed the locking down into this function, but there was an error path where the unlock was missed.

---
Only needed in linux-next.

drivers/media/dvb-core/dvb_ca_en50221.c +5 -2
index 190e5e0..0aac309 100644
@@ -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;
 }
#2 lore raw
Quoted 2 lines · Dan Carpenter

We recently pushed the locking down into this function, but there was an error path where the unlock was missed.

Ugh, indeed. Thanks for catching this!

Nikolaus.