Message ID | 1545716663-123177-1-git-send-email-zhengbin13@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block: Add secure discard check in blk_ioctl_discard | expand |
hi, Jens Axboe When you have time, confirm it? thanks On 2018/12/25 13:44, zhengbin wrote: > blkdev_ioctl--->blk_ioctl_discard(BLKDISCARD or BLKSECDISCARD). > If cmd is BLKSECDISCARD and device does not support this cmd, > we will drop page cache(should not be dropped) and return > EOPNOTSUPP to caller. This patch fixes that. > > Fixes: 351499a172c0 ("block: Invalidate cache on discard v2") > Signed-off-by: zhengbin <zhengbin13@huawei.com> > --- > block/ioctl.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/block/ioctl.c b/block/ioctl.c > index 4825c78..ee3a6af 100644 > --- a/block/ioctl.c > +++ b/block/ioctl.c > @@ -212,6 +212,11 @@ static int blk_ioctl_discard(struct block_device *bdev, fmode_t mode, > if (!blk_queue_discard(q)) > return -EOPNOTSUPP; > > + if (flags & BLKDEV_DISCARD_SECURE) { > + if (!blk_queue_secure_erase(q)) > + return -EOPNOTSUPP; > + } > + > if (copy_from_user(range, (void __user *)arg, sizeof(range))) > return -EFAULT; > > -- > 2.7.4 > > > . >
Ping? On 2018/12/25 13:44, zhengbin wrote: > blkdev_ioctl--->blk_ioctl_discard(BLKDISCARD or BLKSECDISCARD). > If cmd is BLKSECDISCARD and device does not support this cmd, > we will drop page cache(should not be dropped) and return > EOPNOTSUPP to caller. This patch fixes that. > > Fixes: 351499a172c0 ("block: Invalidate cache on discard v2") > Signed-off-by: zhengbin <zhengbin13@huawei.com> > --- > block/ioctl.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/block/ioctl.c b/block/ioctl.c > index 4825c78..ee3a6af 100644 > --- a/block/ioctl.c > +++ b/block/ioctl.c > @@ -212,6 +212,11 @@ static int blk_ioctl_discard(struct block_device *bdev, fmode_t mode, > if (!blk_queue_discard(q)) > return -EOPNOTSUPP; > > + if (flags & BLKDEV_DISCARD_SECURE) { > + if (!blk_queue_secure_erase(q)) > + return -EOPNOTSUPP; > + } > + > if (copy_from_user(range, (void __user *)arg, sizeof(range))) > return -EFAULT; > > -- > 2.7.4 > > > . >
diff --git a/block/ioctl.c b/block/ioctl.c index 4825c78..ee3a6af 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -212,6 +212,11 @@ static int blk_ioctl_discard(struct block_device *bdev, fmode_t mode, if (!blk_queue_discard(q)) return -EOPNOTSUPP; + if (flags & BLKDEV_DISCARD_SECURE) { + if (!blk_queue_secure_erase(q)) + return -EOPNOTSUPP; + } + if (copy_from_user(range, (void __user *)arg, sizeof(range))) return -EFAULT;
blkdev_ioctl--->blk_ioctl_discard(BLKDISCARD or BLKSECDISCARD). If cmd is BLKSECDISCARD and device does not support this cmd, we will drop page cache(should not be dropped) and return EOPNOTSUPP to caller. This patch fixes that. Fixes: 351499a172c0 ("block: Invalidate cache on discard v2") Signed-off-by: zhengbin <zhengbin13@huawei.com> --- block/ioctl.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.4