From patchwork Tue May 23 21:44:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Fields X-Patchwork-Id: 9744093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B1E8D6032B for ; Tue, 23 May 2017 21:45:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A469F2883A for ; Tue, 23 May 2017 21:45:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9952D28841; Tue, 23 May 2017 21:45:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16C582883A for ; Tue, 23 May 2017 21:45:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032455AbdEWVoz (ORCPT ); Tue, 23 May 2017 17:44:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45600 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032015AbdEWVow (ORCPT ); Tue, 23 May 2017 17:44:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B8FDF804ED; Tue, 23 May 2017 21:44:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B8FDF804ED Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=bfields@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B8FDF804ED Received: from parsley.fieldses.org (ovpn-125-26.rdu2.redhat.com [10.10.125.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EA63173B0; Tue, 23 May 2017 21:44:51 +0000 (UTC) Received: by parsley.fieldses.org (Postfix, from userid 2815) id 640B71806A2; Tue, 23 May 2017 17:44:50 -0400 (EDT) Date: Tue, 23 May 2017 17:44:50 -0400 From: "J. Bruce Fields" To: Greg KH Cc: trond.myklebust@primarydata.com, stable@vger.kernel.org, stable-commits@vger.kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH] nfsd: Fix up the "supattr_exclcreat" attributes Message-ID: <20170523214449.GI7556@parsley.fieldses.org> References: <14955646521694@kroah.com> <20170523192339.GA30111@kroah.com> <20170523203824.GG7556@parsley.fieldses.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170523203824.GG7556@parsley.fieldses.org> User-Agent: Mutt/1.8.0 (2017-02-23) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 23 May 2017 21:44:51 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Trond Myklebust commit b26b78cb726007533d81fdf90a62e915002ef5c8 upstream If an NFSv4 client asks us for the supattr_exclcreat, then we must not return attributes that are unsupported by this minor version. Signed-off-by: Trond Myklebust Fixes: 75976de6556f ("NFSD: Return word2 bitmask if setting security..,") [bfields: use old functions instead of new array in stable backport] Signed-off-by: J. Bruce Fields --- fs/nfsd/nfs4xdr.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) On Tue, May 23, 2017 at 04:38:24PM -0400, J. Bruce Fields wrote: > The issue is > > 916d2d844afd "nfsd: clean up supported attribute handling" > dcd208697707 "nfsd: fix supported attributes for acl & labels" > > which replaced 3 numbered constants by an array, and went in between 4.8 > and 4.10. > > But for the purposes of older stable branches, best is probably just to > use the old constants. I'll send an updated patch. Here it is. This should do for 4.9 and older stable branches. diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 12935209deca..37d30e5caf46 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -2753,9 +2753,16 @@ out_acl: } #endif /* CONFIG_NFSD_PNFS */ if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) { - status = nfsd4_encode_bitmap(xdr, NFSD_SUPPATTR_EXCLCREAT_WORD0, - NFSD_SUPPATTR_EXCLCREAT_WORD1, - NFSD_SUPPATTR_EXCLCREAT_WORD2); + u32 supp[3]; + + supp[0] = nfsd_suppattrs0(minorversion); + supp[1] = nfsd_suppattrs1(minorversion); + supp[2] = nfsd_suppattrs2(minorversion); + supp[0] &= NFSD_SUPPATTR_EXCLCREAT_WORD0; + supp[1] &= NFSD_SUPPATTR_EXCLCREAT_WORD1; + supp[2] &= NFSD_SUPPATTR_EXCLCREAT_WORD2; + + status = nfsd4_encode_bitmap(xdr, supp[0], supp[1], supp[2]); if (status) goto out; }