diff options
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r-- | drivers/block/floppy.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 40419b066aa9..3126d5122b2b 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -3616,6 +3616,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
3616 | { | 3616 | { |
3617 | int drive = (long)disk->private_data; | 3617 | int drive = (long)disk->private_data; |
3618 | 3618 | ||
3619 | lock_kernel(); | ||
3619 | mutex_lock(&open_lock); | 3620 | mutex_lock(&open_lock); |
3620 | if (UDRS->fd_ref < 0) | 3621 | if (UDRS->fd_ref < 0) |
3621 | UDRS->fd_ref = 0; | 3622 | UDRS->fd_ref = 0; |
@@ -3626,6 +3627,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
3626 | if (!UDRS->fd_ref) | 3627 | if (!UDRS->fd_ref) |
3627 | opened_bdev[drive] = NULL; | 3628 | opened_bdev[drive] = NULL; |
3628 | mutex_unlock(&open_lock); | 3629 | mutex_unlock(&open_lock); |
3630 | unlock_kernel(); | ||
3629 | 3631 | ||
3630 | return 0; | 3632 | return 0; |
3631 | } | 3633 | } |
@@ -3643,6 +3645,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
3643 | int res = -EBUSY; | 3645 | int res = -EBUSY; |
3644 | char *tmp; | 3646 | char *tmp; |
3645 | 3647 | ||
3648 | lock_kernel(); | ||
3646 | mutex_lock(&open_lock); | 3649 | mutex_lock(&open_lock); |
3647 | old_dev = UDRS->fd_device; | 3650 | old_dev = UDRS->fd_device; |
3648 | if (opened_bdev[drive] && opened_bdev[drive] != bdev) | 3651 | if (opened_bdev[drive] && opened_bdev[drive] != bdev) |
@@ -3719,6 +3722,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
3719 | goto out; | 3722 | goto out; |
3720 | } | 3723 | } |
3721 | mutex_unlock(&open_lock); | 3724 | mutex_unlock(&open_lock); |
3725 | unlock_kernel(); | ||
3722 | return 0; | 3726 | return 0; |
3723 | out: | 3727 | out: |
3724 | if (UDRS->fd_ref < 0) | 3728 | if (UDRS->fd_ref < 0) |
@@ -3729,6 +3733,7 @@ out: | |||
3729 | opened_bdev[drive] = NULL; | 3733 | opened_bdev[drive] = NULL; |
3730 | out2: | 3734 | out2: |
3731 | mutex_unlock(&open_lock); | 3735 | mutex_unlock(&open_lock); |
3736 | unlock_kernel(); | ||
3732 | return res; | 3737 | return res; |
3733 | } | 3738 | } |
3734 | 3739 | ||