From patchwork Mon Oct 24 12:46:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 9392011 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 C6DFA60762 for ; Mon, 24 Oct 2016 12:46:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8EC02900F for ; Mon, 24 Oct 2016 12:46:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADC0129011; Mon, 24 Oct 2016 12:46:52 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 488852900F for ; Mon, 24 Oct 2016 12:46:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932824AbcJXMqv (ORCPT ); Mon, 24 Oct 2016 08:46:51 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36250 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932372AbcJXMqv (ORCPT ); Mon, 24 Oct 2016 08:46:51 -0400 Received: by mail-pf0-f194.google.com with SMTP id r16so16520855pfg.3 for ; Mon, 24 Oct 2016 05:46:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=BSIEFx4mteGx6EXNgmKkTjFYzdh445MaDcPZ0k13TgM=; b=qOlKg5dgvDdsvg7iEjDfSkudbp1l010KUm1zAbfILQ9Sb7R4bc/D2kTBAQoFkFd9Ds qj3e+Dl3ccKULovj8iecjx+TZqJoOmu3My0B7OFegMLZmnyCc45Rzq8SP8ZokV2WER/l 8Fv0VJwOZn6Kvzv35rbk+/T4V4gOCxrnCdNpnR5X9JryqPbwvuAjWmA0tp3/StZRA6LT DL+czoRelVSAWJWdZSk2WD74e/3PZhqcncOHUH3k1HLflEnfOlYGz91MkZUumHpUo+yZ cPHQ5iFDqth6ypAYffyYlmTrTKOsLThO2X/BBBwV9WBlcHQoRxIheeCHYf+UYMjFt4Up 0rqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BSIEFx4mteGx6EXNgmKkTjFYzdh445MaDcPZ0k13TgM=; b=fppPljd0fbS8an9SutbYQGmenH+ReCtjWijOOSxd54ilnDu/qc/qEpneMF5M/MSa6S gghqMPQw5hkXxzFjwWHH8pnpeUJJ1NDvir0z1qOhET2BalEK/i46YPM+np/Fn0uJO1Hl 19lK4fQu68aea8spo5j5qFMoHd128mnr3ejaTDBHnpDQe9cZvZRWpIJLd1Rcq8YmJxU/ DIvJwWSotp+yQM0kBAB4K/kUebzmaC7D4quNAWF1jiHz5jGOMMUvRlUJMLx1rUODbKqG dHK/BqEI1tj7QNqtSoqhc9mmeXDbSAdNqRzAxVhH3VhHjrEVsAVgocN9tZc5wtf4t/sV 1s0g== X-Gm-Message-State: ABUngvfKdoKsIYXy4r0eSScP7rgAbYPk/j/Jk7uLK8SmBZtXwSvGnHFnEqzXc41DfYC2tA== X-Received: by 10.99.94.196 with SMTP id s187mr23786824pgb.107.1477313210432; Mon, 24 Oct 2016 05:46:50 -0700 (PDT) Received: from localhost ([128.199.137.77]) by smtp.gmail.com with ESMTPSA id y2sm25352162pfk.54.2016.10.24.05.46.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Oct 2016 05:46:49 -0700 (PDT) From: Eryu Guan To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, agruenba@redhat.com, Eryu Guan Subject: [PATCH v2] CIFS: iterate over posix acl xattr entry correctly in ACL_to_cifs_posix() Date: Mon, 24 Oct 2016 20:46:40 +0800 Message-Id: <1477313200-26317-1-git-send-email-guaneryu@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 2211d5ba5c6c ("posix_acl: xattr representation cleanups") removes the typedefs and the zero-length a_entries array in struct posix_acl_xattr_header, and uses bare struct posix_acl_xattr_header and struct posix_acl_xattr_entry directly. But it failed to iterate over posix acl slots when converting posix acls to CIFS format, which results in several test failures in xfstests (generic/053 generic/105) when testing against a samba v1 server, starting from v4.9-rc1 kernel. e.g. [root@localhost xfstests]# diff -u tests/generic/105.out /root/xfstests/results//generic/105.out.bad --- tests/generic/105.out 2016-09-19 16:33:28.577962575 +0800 +++ /root/xfstests/results//generic/105.out.bad 2016-10-22 15:41:15.201931110 +0800 @@ -1,3 +1,4 @@ QA output created by 105 -rw-r--r-- root +setfacl: subdir: Invalid argument -rw-r--r-- root Fix it by introducing a new "ace" var, like what cifs_copy_posix_acl() does, and iterating posix acl xattr entries over it in the for loop. Signed-off-by: Eryu Guan --- v2: - move "ace" definition outside for loop fs/cifs/cifssmb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 3f3185f..e3fed92 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -3427,6 +3427,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, __u16 rc = 0; struct cifs_posix_acl *cifs_acl = (struct cifs_posix_acl *)parm_data; struct posix_acl_xattr_header *local_acl = (void *)pACL; + struct posix_acl_xattr_entry *ace = (void *)(local_acl + 1); int count; int i; @@ -3453,8 +3454,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, return 0; } for (i = 0; i < count; i++) { - rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], - (struct posix_acl_xattr_entry *)(local_acl + 1)); + rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], &ace[i]); if (rc != 0) { /* ACE not converted */ break;