aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2009-02-04 15:12:20 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-02-05 12:56:48 -0800
commit736d54533aedbcbde8cfb2f9ccd542595db4d78d (patch)
tree83fbdc15a5ad032e47c9d237617a67866303767b /drivers
parentfe86175bce50bc3d65ff09c287fed955c4da1eb3 (diff)
sx.c: fix missed unlock_kernel() on error path in sx_fw_ioctl()
If we return directly with -EPERM then lock_kernel() is still held. This was found with a code checker (http://repo.or.cz/w/smatch.git/). [akpm@linux-foundation.org: fix another such path - missed func_exit()] Signed-off-by: Dan Carpenter <error27@gmail.com> Cc: <R.E.Wolff@BitWizard.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/sx.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index b60be7b0dec..f146e90404f 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -1713,8 +1713,8 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
for (i = 0; i < SX_NBOARDS; i++)
sx_dprintk(SX_DEBUG_FIRMWARE, "<%x> ", boards[i].flags);
sx_dprintk(SX_DEBUG_FIRMWARE, "\n");
- unlock_kernel();
- return -EIO;
+ rc = -EIO;
+ goto out;
}
switch (cmd) {
@@ -1747,7 +1747,8 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
break;
case SXIO_DO_RAMTEST:
if (sx_initialized) /* Already initialized: better not ramtest the board. */
- return -EPERM;
+ rc = -EPERM;
+ break;
if (IS_SX_BOARD(board)) {
rc = do_memtest(board, 0, 0x7000);
if (!rc)
@@ -1844,6 +1845,7 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
rc = -ENOTTY;
break;
}
+out:
unlock_kernel();
func_exit();
return rc;