Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6853583rwn; Tue, 13 Sep 2022 09:52:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR5ow30cCIRTu99Kk77Y1QXTocva7ui0v8qaiAVN4l/LgNrfJQrvSts6d0lL9uQtQIfDsK0x X-Received: by 2002:a05:6402:2c6:b0:44e:7d0a:c231 with SMTP id b6-20020a05640202c600b0044e7d0ac231mr26699421edx.283.1663087979176; Tue, 13 Sep 2022 09:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663087979; cv=none; d=google.com; s=arc-20160816; b=t2Ey5UWWkTB/qm7DCClxCDwR7SKgLYCexCcxRPiC8bOds24ghKGbw6hdfnxNGmTfAM IetjCRrXbp3PSFJtSQC+PVbssG2vKMgVOjPBc+BVvlJnyjsBv6G32NXfusLa9/D5BF+i oyQ1ASz7i9Ofi8XG48+9TBJfxF1ja8nPUwo525rtXQ5kZvq+EUHTefwJT8AFfkCqfdfP 9wsjIfIMuC03vqgli3hd2Z3F+21GEu5MXbU6EdIs5cXRHYzVWULGfIWJAqJjjAkIJmIp lwRYQPiQJZrEqkC98nwodLmY7M4mECwC2SjrWvJ7oLGYxYN5miQvHXR6bpCKL/KeTm9v oy2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=3JPboGONJDKMkiniqT3OEGQtjk1+k+ROHzupL6jDjw0=; b=wuLMvcuv4kKDrWQkHuIezAe/dW/VIIKF4s+Jtv4WBh3WYkvuTiAuB8jZE+nNSsGxqj /PhREyTsmJOefwK7torZBAY6riLgMky8K92qqXf62xUJ4HJKrvqFfhgflMLuAMyY/Rqu 3BXDrCsXwXM5ibETe/IUan2MK2hEJPj+u8Xpbdgtyi+mT4rtRVgooTnlJnbLJNMfno/L lVl40srpv4bZrtkEj7tQ4Clw1+Z8iV0oGpCqQ21eaC78tC1FeVS0vCAgwZ8u5Fjh6HSC yTmjpESF8Si+qXTb3hLjmdqmT3N2eNrXu0R4dRJhbmj7sf0a7l02r7exljPxgZeM870k gBQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JLc76ldh; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a1709062a0e00b0073e77b84e1bsi8153242eje.868.2022.09.13.09.52.20; Tue, 13 Sep 2022 09:52:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JLc76ldh; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231841AbiIMQr7 (ORCPT + 99 others); Tue, 13 Sep 2022 12:47:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231582AbiIMQrb (ORCPT ); Tue, 13 Sep 2022 12:47:31 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BA76BD1C2 for ; Tue, 13 Sep 2022 08:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663083600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3JPboGONJDKMkiniqT3OEGQtjk1+k+ROHzupL6jDjw0=; b=JLc76ldhzXF71WvgR9b/ybfiZWvVPz5rXRgiFTM7QzNy/6824o9kee1jcUx1FyLJqExowx Y9H79uastCYBIMDNbgJLXrt7SK2d/xHpWd+SfExCmyNElKDHuauz8sHeuUC1hPAde0dtIl fqzL+Cj+5q7yfWG62FUrvahAjhFhLMQ= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-617-TAt15wjOM-64MStJkF-mSg-1; Tue, 13 Sep 2022 11:36:29 -0400 X-MC-Unique: TAt15wjOM-64MStJkF-mSg-1 Received: by mail-qt1-f200.google.com with SMTP id ci6-20020a05622a260600b0034370b6f5d6so10164207qtb.14 for ; Tue, 13 Sep 2022 08:36:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=3JPboGONJDKMkiniqT3OEGQtjk1+k+ROHzupL6jDjw0=; b=uSLbxwCAyqjzhzQm4UEPCa1mjFU7UylGnlTVIoK2MEzgsxcRTl/5hnIZyezotEwTS6 wsRKAtgMF95kKE3/RoSCcB2W4+zvgUTxUk4u08bNdGMHG96mStBS6BoYOB/UM1Tp62DA XErhCij5jUL8YN2uja3hSCwMfMpKJMFVcQ9we42NM1mirvOLZFSG3HSAIT+IBX0SsnE0 zk4BwLyUEvtWlQouz+UYmJWSq8OfSib2Uej5yZo4WGO//6+adqKoLob3foSAA9WNXTAP PPGT9lmGM7+XU4kCsGUYMEqGJOUhZvTwN+/VXZ+tJYMzRBknZRXOvg/AcGFEF8A8LlH4 wuaA== X-Gm-Message-State: ACgBeo39fwXQ3a2yDKBNGHvdpSYYJZrTRzjaZV8Zlsw3EQah3aj625dv OqOBPXkBCCPI6gNJ3F5Lww7uRHUPo1J+41oM7svFiTPhCJ3t/Zn0xiTmhOzyQVKqlyQylxupLT2 d+afUCWutqUq65G0u+1rb X-Received: by 2002:ac8:7d90:0:b0:35b:b5b2:e05a with SMTP id c16-20020ac87d90000000b0035bb5b2e05amr8380042qtd.513.1663083388390; Tue, 13 Sep 2022 08:36:28 -0700 (PDT) X-Received: by 2002:ac8:7d90:0:b0:35b:b5b2:e05a with SMTP id c16-20020ac87d90000000b0035bb5b2e05amr8380019qtd.513.1663083388118; Tue, 13 Sep 2022 08:36:28 -0700 (PDT) Received: from [10.19.60.33] (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id i2-20020a05620a248200b006bba46e5eeasm10340551qkn.37.2022.09.13.08.36.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Sep 2022 08:36:26 -0700 (PDT) Message-ID: <6da609ed-13f8-9cc7-b988-ad46d3f9ed93@redhat.com> Date: Tue, 13 Sep 2022 11:36:26 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH v2] libnfs4acl: Check file mode before getxattr call Content-Language: en-US To: Kenneth Dsouza , linux-nfs@vger.kernel.org References: <20220811194834.470072-1-kdsouza@redhat.com> From: Steve Dickson In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 9/12/22 2:24 PM, Kenneth Dsouza wrote: > ping Sorry about that... Thanks for the ping! > > On Fri, Aug 12, 2022 at 1:19 AM Kenneth D'souza wrote: >> >> Currently we are checking file mode after getxattr call. >> Due to this the return value would be 0, which would change the getxattr return value. >> As xattr_size will be 0, nfs4_getfacl will fail with error EINVAL. >> This patch fixes this issue by moving the file mode check before >> getxattr call. >> >> Signed-off-by: Kenneth D'souza Committed... (tag: nfs4-acl-tools-0.4.1-rc2) steved. >> --- >> libnfs4acl/nfs4_getacl.c | 14 +++++++------- >> 1 file changed, 7 insertions(+), 7 deletions(-) >> >> diff --git a/libnfs4acl/nfs4_getacl.c b/libnfs4acl/nfs4_getacl.c >> index 7821da3..aace5cd 100644 >> --- a/libnfs4acl/nfs4_getacl.c >> +++ b/libnfs4acl/nfs4_getacl.c >> @@ -39,6 +39,13 @@ static struct nfs4_acl *nfs4_getacl_byname(const char *path, >> return NULL; >> } >> >> + ret = stat(path, &st); >> + if (ret == -1) >> + goto err; >> + >> + if (S_ISDIR(st.st_mode)) >> + iflags = NFS4_ACL_ISDIR; >> + >> /* find necessary buffer size */ >> ret = getxattr(path, xattr_name, NULL, 0); >> if (ret == -1) >> @@ -53,13 +60,6 @@ static struct nfs4_acl *nfs4_getacl_byname(const char *path, >> if (ret == -1) >> goto err_free; >> >> - ret = stat(path, &st); >> - if (ret == -1) >> - goto err_free; >> - >> - if (S_ISDIR(st.st_mode)) >> - iflags = NFS4_ACL_ISDIR; >> - >> acl = acl_nfs41_xattr_load(buf, ret, iflags, type); >> >> free(buf); >> -- >> 2.31.1 >> >