Skip to contentSkip to conversation

blkdev: cgroup whitelist permission fix

PATCH In review Chris Wright 1 participant 2 messages Jun 4, 2010 – Jul 15, 2010 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blkdev: cgroup whitelist permission fix

The cgroup device whitelist code gets confused when trying to grant permission to a disk partition that is not currently open. Part of blkdev_open() includes __blkdev_get() on the whole disk. This simply avoids the cgroup check for the whole disk case when opening a partition.

https://bugzilla.redhat.com/show_bug.cgi?id=589662

---
 fs/block_dev.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
fs/block_dev.c +6 -4
index 7346c96..09b107e 100644
@@ -1315,10 +1315,12 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
 	/*
 	 * hooks: /n/, see "layering violations".
 	 */
-	ret = devcgroup_inode_permission(bdev->bd_inode, perm);
-	if (ret != 0) {
-		bdput(bdev);
-		return ret;
+	if (!for_part) {
+		ret = devcgroup_inode_permission(bdev->bd_inode, perm);
+		if (ret != 0) {
+			bdput(bdev);
+			return ret;
+		}
 	}
 
 	lock_kernel();
#1 lore raw
Quoted 11 lines · * Chris Wright ([email protected]) wrote:

The cgroup device whitelist code gets confused when trying to grant permission to a disk partition that is not currently open. Part of blkdev_open() includes __blkdev_get() on the whole disk. This simply avoids the cgroup check for the whole disk case when opening a partition.

https://bugzilla.redhat.com/show_bug.cgi?id=589662

Andrew, plans to push this on? Christoph doesn't like the whole of blockdev whitelisting for good reason, but it's currently in use and has this bug.

thanks,
-chris