Skip to content

Commit

Permalink
floppy: fix lock imbalance
Browse files Browse the repository at this point in the history
A crappy macro prevents us unlocking on a fail path.

Expand the macro and unlock appropriatelly.

Signed-off-by: Jiri Slaby <[email protected]>
Cc: Jens Axboe <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
jirislaby authored and torvalds committed Jul 1, 2009
1 parent 9980060 commit 8516a50
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down

0 comments on commit 8516a50

Please sign in to comment.