From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D09DC3A59F for ; Sat, 31 Aug 2019 10:32:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F18B22CE9 for ; Sat, 31 Aug 2019 10:32:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728144AbfHaKcc (ORCPT ); Sat, 31 Aug 2019 06:32:32 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:40354 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727404AbfHaKcb (ORCPT ); Sat, 31 Aug 2019 06:32:31 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E7011FF38C00B8F8B49E; Sat, 31 Aug 2019 18:32:29 +0800 (CST) Received: from [10.134.22.195] (10.134.22.195) by smtp.huawei.com (10.3.19.213) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 31 Aug 2019 18:32:29 +0800 Subject: Re: [PATCH] ext4 crypto: fix to check feature status before get policy To: , , CC: Chao Yu , , , References: <20190804095643.7393-1-chao@kernel.org> From: Chao Yu Message-ID: Date: Sat, 31 Aug 2019 18:32:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190804095643.7393-1-chao@kernel.org> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Hi, Is this change not necessary? A month has passed... Thanks, On 2019/8/4 17:56, Chao Yu wrote: > From: Chao Yu > > 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 > --- > 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; >