Commit 8f9064a8 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3fb95e56
...@@ -1020,12 +1020,12 @@ static int vmk80xx_cnt_cinsn(struct comedi_device *cdev, ...@@ -1020,12 +1020,12 @@ static int vmk80xx_cnt_cinsn(struct comedi_device *cdev,
if (n) if (n)
return n; return n;
down(&dev->limit_sem);
insn_cmd = data[0]; insn_cmd = data[0];
if (insn_cmd != INSN_CONFIG_RESET && insn_cmd != GPCT_RESET) if (insn_cmd != INSN_CONFIG_RESET && insn_cmd != GPCT_RESET)
return -EINVAL; return -EINVAL;
down(&dev->limit_sem);
chan = CR_CHAN(insn->chanspec); chan = CR_CHAN(insn->chanspec);
if (dev->board.model == VMK8055_MODEL) { if (dev->board.model == VMK8055_MODEL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment