diff options
author | Mike Snitzer <snitzer@redhat.com> | 2015-11-17 14:11:34 -0500 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2015-11-17 14:18:49 -0500 |
commit | 647a20d5cad7477033bc021ec9dd75edf4bbf9a0 (patch) | |
tree | 459ab91e5d61c98a2607f5414af593d46705eaa0 /drivers/md/dm.c | |
parent | 5bbbfdf685657771fda05b926b28ca0f79163a28 (diff) |
dm: do not reuse dm_blk_ioctl block_device input as local variable
(Ab)using the @bdev passed to dm_blk_ioctl() opens the potential for
targets' .prepare_ioctl to fail if they go on to check the bdev for
!NULL.
Fixes: e56f81e0b01e ("dm: refactor ioctl handling")
Reported-by: Junichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index fabd5d8fd559..5df40480228b 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -603,9 +603,10 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode, { struct mapped_device *md = bdev->bd_disk->private_data; struct dm_target *tgt; + struct block_device *tgt_bdev = NULL; int srcu_idx, r; - r = dm_get_live_table_for_ioctl(md, &tgt, &bdev, &mode, &srcu_idx); + r = dm_get_live_table_for_ioctl(md, &tgt, &tgt_bdev, &mode, &srcu_idx); if (r < 0) return r; @@ -620,7 +621,7 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode, goto out; } - r = __blkdev_driver_ioctl(bdev, mode, cmd, arg); + r = __blkdev_driver_ioctl(tgt_bdev, mode, cmd, arg); out: dm_put_live_table(md, srcu_idx); return r; |