]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
floppy: fix lock imbalance
authorJiri Slaby <jirislaby@gmail.com>
Tue, 30 Jun 2009 18:41:44 +0000 (11:41 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Jul 2009 03:45:00 +0000 (20:45 -0700)
commit 8516a500029890a72622d245f8ed32c4e30969b7 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/block/floppy.c

index 615fcd33e832915ca983e14609078a43510603ad..5900f768e69e2039fd5c0647e78b86f06c49f5de 100644 (file)
@@ -3320,7 +3320,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++)