From patchwork Thu Jul 30 13:54:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 6902941 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2ADF69F38B for ; Thu, 30 Jul 2015 13:54:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 29C57205BC for ; Thu, 30 Jul 2015 13:54:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5360A20582 for ; Thu, 30 Jul 2015 13:54:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752230AbbG3Nyn (ORCPT ); Thu, 30 Jul 2015 09:54:43 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:36789 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750879AbbG3Nym (ORCPT ); Thu, 30 Jul 2015 09:54:42 -0400 Received: by pachj5 with SMTP id hj5so23979817pac.3 for ; Thu, 30 Jul 2015 06:54:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=uhU0zo4id+m2tibQVMSarlsUXiqpNdEim1PAie+cNcE=; b=E/H6H3pU/DSb0jjFbQKCrok4VPovP1M8GzkRHOKy5LilFP8Xt/uEHnMaK/S+ugRiVj P5EffiJhUqvpeI/HrE0jGXBWpF+4o6e/BPTGy29KSUNAW80IXWfMEAjaoa/gTygENNER 7lSBrxvy/EbuPqn/8GObGBuErDr9Lxb0urFu2vyAcBsrNzZrNPkME1ayVVzIe4xfcCA2 hYfZnl+ewi+JAY2he8H3aploGODPwxm6TrTuZWugrfteeiaV+8muHJYtQ9h98wT+z8Vk 4Q2p5VT5ltV6c0c9QzDEBMWEr0LsRZzp190kOPoxJCqTpcffO0lfpW3jjWuY4nBUm/A5 e1wA== X-Received: by 10.66.55.66 with SMTP id q2mr106123931pap.94.1438264482318; Thu, 30 Jul 2015 06:54:42 -0700 (PDT) Received: from [192.168.99.8] ([104.143.41.79]) by smtp.googlemail.com with ESMTPSA id s3sm2427798pdl.35.2015.07.30.06.54.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2015 06:54:41 -0700 (PDT) Message-ID: <55BA2C92.5000600@gmail.com> Date: Thu, 30 Jul 2015 21:54:26 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: "linux-nfs@vger.kernel.org" , kinglongmee@gmail.com Subject: [PATCH 3/5] nfsd: SUPPATTR_EXCLCREAT must be encoded before SECURITY_LABEL. References: <55BA2B46.90204@gmail.com> In-Reply-To: <55BA2B46.90204@gmail.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The encode order should be as the bitmask defined order. Signed-off-by: Kinglong Mee --- fs/nfsd/nfs4xdr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 76d6653..21e1263 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -2734,12 +2734,6 @@ out_acl: *p++ = cpu_to_be32(stat.blksize); } #endif /* CONFIG_NFSD_PNFS */ - if (bmval2 & FATTR4_WORD2_SECURITY_LABEL) { - status = nfsd4_encode_security_label(xdr, rqstp, context, - contextlen); - if (status) - goto out; - } if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) { p = xdr_reserve_space(xdr, 16); if (!p) @@ -2750,6 +2744,13 @@ out_acl: *p++ = cpu_to_be32(NFSD_SUPPATTR_EXCLCREAT_WORD2); } + if (bmval2 & FATTR4_WORD2_SECURITY_LABEL) { + status = nfsd4_encode_security_label(xdr, rqstp, context, + contextlen); + if (status) + goto out; + } + attrlen = htonl(xdr->buf->len - attrlen_offset - 4); write_bytes_to_xdr_buf(xdr->buf, attrlen_offset, &attrlen, 4); status = nfs_ok;