summaryrefslogtreecommitdiffstats
path: root/drivers/block/floppy.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2009-06-30 11:41:44 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-30 18:56:01 -0700
commit8516a500029890a72622d245f8ed32c4e30969b7 (patch)
tree8621a8d000d1397006a854c7d9de0d5d46842448 /drivers/block/floppy.c
parent9980060bad5607ca6db7fb8683de671b522e56a4 (diff)
downloadlinux-8516a500029890a72622d245f8ed32c4e30969b7.tar.gz
linux-8516a500029890a72622d245f8ed32c4e30969b7.tar.bz2
linux-8516a500029890a72622d245f8ed32c4e30969b7.zip
floppy: fix lock imbalance
A crappy macro prevents us unlocking on a fail path. Expand the macro and unlock appropriatelly. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Cc: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r--drivers/block/floppy.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 862b40c90181..91b753013780 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3327,7 +3327,10 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g,
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
mutex_lock(&open_lock);
- LOCK_FDC(drive, 1);
+ if (lock_fdc(drive, 1)) {
+ mutex_unlock(&open_lock);
+ return -EINTR;
+ }
floppy_type[type] = *g;
floppy_type[type].name = "user format";
for (cnt = type << 2; cnt < (type << 2) + 4; cnt++)