diff options
author | Dan Carpenter <error27@gmail.com> | 2010-04-18 22:07:33 +0300 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-04-19 16:04:13 +0200 |
commit | 07a71415d5f790385695784a9b0e554412ee95c3 (patch) | |
tree | b9ce527d511d0f1b50c8b532e484c8bec751a316 | |
parent | 42d284b986105a6ed5ac386818cae093532b2c55 (diff) |
pcmcia: fix error handling in cm4000_cs.c
In the original code we used -ENODEV as the number of bytes to
copy_to_user() and we didn't release the locks.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Harald Welte <laforge@gnumonks.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r-- | drivers/char/pcmcia/cm4000_cs.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index c9bc896d68af..90b199f97bec 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1026,14 +1026,16 @@ static ssize_t cmm_read(struct file *filp, __user char *buf, size_t count, xoutb(0, REG_FLAGS1(iobase)); /* clear detectCMM */ /* last check before exit */ - if (!io_detect_cm4000(iobase, dev)) - count = -ENODEV; + if (!io_detect_cm4000(iobase, dev)) { + rc = -ENODEV; + goto release_io; + } if (test_bit(IS_INVREV, &dev->flags) && count > 0) str_invert_revert(dev->rbuf, count); if (copy_to_user(buf, dev->rbuf, count)) - return -EFAULT; + rc = -EFAULT; release_io: clear_bit(LOCK_IO, &dev->flags); |