From 8f9064a8a3b9f0dfd53bb0dfb3bbbfb457dda4bb Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 20 Apr 2012 14:46:27 +0300 Subject: [PATCH] staging: 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. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/vmk80xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index 10ac58d0cddd..856d0ea6007f 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -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) { -- 2.39.5