Skip to content

Commit

Permalink
staging: comedi vmk80xx: lock held on error path
Browse files Browse the repository at this point in the history
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 <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Apr 20, 2012
1 parent 3fb95e5 commit 8f9064a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/comedi/drivers/vmk80xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8f9064a

Please sign in to comment.