mirror of
https://github.com/torvalds/linux.git
synced 2024-12-01 08:31:37 +00:00
md: check the return of mddev_find()
Check the return of mddev_find(), since it may fail due to out of memeory or out of usable minor number. The reason I chose -ENODEV instead of -ENOMEM or something else is md_alloc() function chose that ;) Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
4f0a5e012c
commit
0c098220e2
@ -6618,6 +6618,9 @@ static int md_open(struct block_device *bdev, fmode_t mode)
|
||||
struct mddev *mddev = mddev_find(bdev->bd_dev);
|
||||
int err;
|
||||
|
||||
if (!mddev)
|
||||
return -ENODEV;
|
||||
|
||||
if (mddev->gendisk != bdev->bd_disk) {
|
||||
/* we are racing with mddev_put which is discarding this
|
||||
* bd_disk.
|
||||
|
Loading…
Reference in New Issue
Block a user