Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e4b5af7 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "block: Revalidate i_bdev reference in bd_aquire()"

parents 3d60ba70 c1d5f2a9
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -787,13 +787,22 @@ static struct block_device *bd_acquire(struct inode *inode)

	spin_lock(&bdev_lock);
	bdev = inode->i_bdev;
	if (bdev) {
	if (bdev && !inode_unhashed(bdev->bd_inode)) {
		bdgrab(bdev);
		spin_unlock(&bdev_lock);
		return bdev;
	}
	spin_unlock(&bdev_lock);

	/*
	 * i_bdev references block device inode that was already shut down
	 * (corresponding device got removed).  Remove the reference and look
	 * up block device inode again just in case new device got
	 * reestablished under the same device number.
	 */
	if (bdev)
		bd_forget(inode);

	bdev = bdget(inode->i_rdev);
	if (bdev) {
		spin_lock(&bdev_lock);