Skip to contentSkip to conversation

comedi vmk80xx: lock held on error path

PATCH New Dan Carpenter 1 participant 1 message Apr 20, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 comedi vmk80xx: lock held on error path

If the user passes an invalid command, then we don't drop the lock before returning. The check for invalid commands doesn't need to be done under lock so I moved it forward a couple lines.

drivers/staging/comedi/drivers/vmk80xx.c +2 -2
index 10ac58d..856d0ea 100644
@@ -1020,12 +1020,12 @@ static int vmk80xx_cnt_cinsn(struct comedi_device *cdev,
 	if (n)
 		return n;
 
-	down(&dev->limit_sem);
-
 	insn_cmd = data[0];
 	if (insn_cmd != INSN_CONFIG_RESET && insn_cmd != GPCT_RESET)
 		return -EINVAL;
 
+	down(&dev->limit_sem);
+
 	chan = CR_CHAN(insn->chanspec);
 
 	if (dev->board.model = VMK8055_MODEL) {