Commit 8516a500029890a72622d245f8ed32c4e30969b7

Authored by Jiri Slaby
Committed by Linus Torvalds
1 parent 9980060bad

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>

Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff

drivers/block/floppy.c
... ... @@ -3327,7 +3327,10 @@
3327 3327 if (!capable(CAP_SYS_ADMIN))
3328 3328 return -EPERM;
3329 3329 mutex_lock(&open_lock);
3330   - LOCK_FDC(drive, 1);
  3330 + if (lock_fdc(drive, 1)) {
  3331 + mutex_unlock(&open_lock);
  3332 + return -EINTR;
  3333 + }
3331 3334 floppy_type[type] = *g;
3332 3335 floppy_type[type].name = "user format";
3333 3336 for (cnt = type << 2; cnt < (type << 2) + 4; cnt++)