lkml.org 
[lkml]   [2019]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] ext4 crypto: fix to check feature status before get policy
    Date
    From: Chao Yu <yuchao0@huawei.com>

    When getting fscrypto policy via EXT4_IOC_GET_ENCRYPTION_POLICY, if
    encryption feature is off, it's better to return EOPNOTSUPP instead
    of ENODATA, so let's add ext4_has_feature_encrypt() to do the check
    for that.

    Signed-off-by: Chao Yu <yuchao0@huawei.com>
    ---
    fs/ext4/ioctl.c | 6 ++++--
    1 file changed, 4 insertions(+), 2 deletions(-)

    diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
    index 442f7ef873fc..bf87835c1237 100644
    --- a/fs/ext4/ioctl.c
    +++ b/fs/ext4/ioctl.c
    @@ -1112,9 +1112,11 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
    return -EOPNOTSUPP;
    #endif
    }
    - case EXT4_IOC_GET_ENCRYPTION_POLICY:
    + case EXT4_IOC_GET_ENCRYPTION_POLICY: {
    + if (!ext4_has_feature_encrypt(sb))
    + return -EOPNOTSUPP;
    return fscrypt_ioctl_get_policy(filp, (void __user *)arg);
    -
    + }
    case EXT4_IOC_FSGETXATTR:
    {
    struct fsxattr fa;
    --
    2.22.0
    \
     
     \ /
      Last update: 2019-08-04 11:58    [W:4.248 / U:0.284 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site