Re: [PATCH] block: Add secure discard check in blk_ioctl_discard

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

 



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@xxxxxxxxxx>
> ---
>  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
> 
> 
> .
> 




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux