Skip to content

Commit 8f9064a

Browse files
Dan Carpentergregkh
authored andcommitted
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 <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3fb95e5 commit 8f9064a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/staging/comedi/drivers/vmk80xx.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,12 +1020,12 @@ static int vmk80xx_cnt_cinsn(struct comedi_device *cdev,
10201020
if (n)
10211021
return n;
10221022

1023-
down(&dev->limit_sem);
1024-
10251023
insn_cmd = data[0];
10261024
if (insn_cmd != INSN_CONFIG_RESET && insn_cmd != GPCT_RESET)
10271025
return -EINVAL;
10281026

1027+
down(&dev->limit_sem);
1028+
10291029
chan = CR_CHAN(insn->chanspec);
10301030

10311031
if (dev->board.model == VMK8055_MODEL) {

0 commit comments

Comments
 (0)