+ dm-support-ioctls-on-mapped-devices-fix-with-fake-file.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     dm: support ioctls on mapped devices: fix with fake file

has been added to the -mm tree.  Its filename is

     dm-support-ioctls-on-mapped-devices-fix-with-fake-file.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: dm: support ioctls on mapped devices: fix with fake file
From: Milan Broz <mbroz@xxxxxxxxxx>

The new ioctl code passes the wrong file pointer to the underlying device. 
No file pointer is available so make a temporary fake one.

ioctl_by_bdev() does set_fs(KERNEL_DS) so it's for ioctls originating
within the kernel and unsuitable here.  We are processing ioctls that
originated in userspace and mapping them to different devices.  Fixing the
existing callers that pass a NULL file struct and consolidating the
fake_file users are separate matters to solve in later patches.

Signed-off-by: Milan Broz <mbroz@xxxxxxxxxx>
Signed-off-by: Alasdair G Kergon <agk@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/md/dm-linear.c |    8 +++++++-
 drivers/md/dm-mpath.c  |   13 ++++++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)

diff -puN drivers/md/dm-linear.c~dm-support-ioctls-on-mapped-devices-fix-with-fake-file drivers/md/dm-linear.c
--- a/drivers/md/dm-linear.c~dm-support-ioctls-on-mapped-devices-fix-with-fake-file
+++ a/drivers/md/dm-linear.c
@@ -104,8 +104,14 @@ static int linear_ioctl(struct dm_target
 {
 	struct linear_c *lc = (struct linear_c *) ti->private;
 	struct block_device *bdev = lc->dev->bdev;
+	struct file fake_file = {};
+	struct dentry fake_dentry = {};
 
-	return blkdev_driver_ioctl(bdev->bd_inode, filp, bdev->bd_disk, cmd, arg);
+	fake_file.f_mode = lc->dev->mode;
+	fake_file.f_dentry = &fake_dentry;
+	fake_dentry.d_inode = bdev->bd_inode;
+
+	return blkdev_driver_ioctl(bdev->bd_inode, &fake_file, bdev->bd_disk, cmd, arg);
 }
 
 static struct target_type linear_target = {
diff -puN drivers/md/dm-mpath.c~dm-support-ioctls-on-mapped-devices-fix-with-fake-file drivers/md/dm-mpath.c
--- a/drivers/md/dm-mpath.c~dm-support-ioctls-on-mapped-devices-fix-with-fake-file
+++ a/drivers/md/dm-mpath.c
@@ -1273,15 +1273,22 @@ static int multipath_ioctl(struct dm_tar
 	struct multipath *m = (struct multipath *) ti->private;
 	struct block_device *bdev = NULL;
 	unsigned long flags;
+	struct file fake_file = {};
+	struct dentry fake_dentry = {};
 	int r = 0;
 
+	fake_file.f_dentry = &fake_dentry;
+
 	spin_lock_irqsave(&m->lock, flags);
 
 	if (!m->current_pgpath)
 		__choose_pgpath(m);
 
-	if (m->current_pgpath)
+	if (m->current_pgpath) {
 		bdev = m->current_pgpath->path.dev->bdev;
+		fake_dentry.d_inode = bdev->bd_inode;
+		fake_file.f_mode = m->current_pgpath->path.dev->mode;
+	}
 
 	if (m->queue_io)
 		r = -EAGAIN;
@@ -1290,8 +1297,8 @@ static int multipath_ioctl(struct dm_tar
 
 	spin_unlock_irqrestore(&m->lock, flags);
 
-	return r ? : blkdev_driver_ioctl(bdev->bd_inode, filp, bdev->bd_disk,
-		     cmd, arg);
+	return r ? : blkdev_driver_ioctl(bdev->bd_inode, &fake_file,
+					 bdev->bd_disk, cmd, arg);
 }
 
 /*-----------------------------------------------------------------
_

Patches currently in -mm which might be from mbroz@xxxxxxxxxx are

git-block.patch
dm-support-ioctls-on-mapped-devices.patch
dm-linear-support-ioctls.patch
dm-mpath-support-ioctls.patch
dm-support-ioctls-on-mapped-devices-fix-with-fake-file.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux