diff options
Diffstat (limited to 'drivers/block/ub.c')
-rw-r--r-- | drivers/block/ub.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 102ed52d0e0f..c48e14878582 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -1711,6 +1711,18 @@ err_open: | |||
1711 | return rc; | 1711 | return rc; |
1712 | } | 1712 | } |
1713 | 1713 | ||
1714 | static int ub_bd_unlocked_open(struct block_device *bdev, fmode_t mode) | ||
1715 | { | ||
1716 | int ret; | ||
1717 | |||
1718 | lock_kernel(); | ||
1719 | ret = ub_bd_open(bdev, mode); | ||
1720 | unlock_kernel(); | ||
1721 | |||
1722 | return ret; | ||
1723 | } | ||
1724 | |||
1725 | |||
1714 | /* | 1726 | /* |
1715 | */ | 1727 | */ |
1716 | static int ub_bd_release(struct gendisk *disk, fmode_t mode) | 1728 | static int ub_bd_release(struct gendisk *disk, fmode_t mode) |
@@ -1718,7 +1730,10 @@ static int ub_bd_release(struct gendisk *disk, fmode_t mode) | |||
1718 | struct ub_lun *lun = disk->private_data; | 1730 | struct ub_lun *lun = disk->private_data; |
1719 | struct ub_dev *sc = lun->udev; | 1731 | struct ub_dev *sc = lun->udev; |
1720 | 1732 | ||
1733 | lock_kernel(); | ||
1721 | ub_put(sc); | 1734 | ub_put(sc); |
1735 | unlock_kernel(); | ||
1736 | |||
1722 | return 0; | 1737 | return 0; |
1723 | } | 1738 | } |
1724 | 1739 | ||
@@ -1798,7 +1813,7 @@ static int ub_bd_media_changed(struct gendisk *disk) | |||
1798 | 1813 | ||
1799 | static const struct block_device_operations ub_bd_fops = { | 1814 | static const struct block_device_operations ub_bd_fops = { |
1800 | .owner = THIS_MODULE, | 1815 | .owner = THIS_MODULE, |
1801 | .open = ub_bd_open, | 1816 | .open = ub_bd_unlocked_open, |
1802 | .release = ub_bd_release, | 1817 | .release = ub_bd_release, |
1803 | .ioctl = ub_bd_ioctl, | 1818 | .ioctl = ub_bd_ioctl, |
1804 | .media_changed = ub_bd_media_changed, | 1819 | .media_changed = ub_bd_media_changed, |