Commit 8516a500 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

floppy: fix lock imbalance

A crappy macro prevents us unlocking on a fail path.

Expand the macro and unlock appropriatelly.
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9980060b
...@@ -3327,7 +3327,10 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g, ...@@ -3327,7 +3327,10 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
mutex_lock(&open_lock); 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] = *g;
floppy_type[type].name = "user format"; floppy_type[type].name = "user format";
for (cnt = type << 2; cnt < (type << 2) + 4; cnt++) for (cnt = type << 2; cnt < (type << 2) + 4; cnt++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment