From patchwork Sat Oct 22 08:14: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: 9390381 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 1FDF2600CB for ; Sat, 22 Oct 2016 08:15:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA0D52939D for ; Sat, 22 Oct 2016 08:15:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6FCA293CB; Sat, 22 Oct 2016 08:15:02 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 227C22939D for ; Sat, 22 Oct 2016 08:14:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753181AbcJVIO4 (ORCPT ); Sat, 22 Oct 2016 04:14:56 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36465 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752111AbcJVIOy (ORCPT ); Sat, 22 Oct 2016 04:14:54 -0400 Received: by mail-wm0-f65.google.com with SMTP id f193so1887132wmg.3 for ; Sat, 22 Oct 2016 01:14:53 -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=AWvKbcVm89x81geOQCnViC7vAsboctWmcFjC3aYfj+w=; b=EanO8ruGPiUQSRwtCgjIMSz8urgEdhXaneCSYo11o9kF+gOigb+pS89+v0Z+thsWPc JJPjRBVsfQIAXdV+3+y3mP1WGSx89+ebtCc+E9o2OosxBAm3NzUg5kcVtZP6+cWJoYsD Tnncrs6WijtymUwdmNZMpMZbanY0Q9A/wZ4LU8MOm18ggFTBizWwqbi0jnVJVpqbla5B 4jaUempPklY4NkDSFuSHqzVV7HaNEdrS9kPPn0vLI/x427Zx954a2SsAn7vgv6yIUcZE J8jVvkSEV86QnsL+MkvsGJ5KFd1yJ1FUuAz9yu8lDJU0kWKEODVWpbc0GkjQy8VgpFVu uliw== 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=AWvKbcVm89x81geOQCnViC7vAsboctWmcFjC3aYfj+w=; b=RFHITVXqO2vnw9jZCDz8IoKmbKMw+l3kpuM8RuZJk05WgADIJQWLuTQEMqMY6t7EvQ tZpWTJIUXdst6tSMmlGRqccCSZa1Rcs2skZgcfK6X1tbGMyqbe8oW51IMM+/PjpzAegD WqO7XQcFTfBRVWiWrDmBvXIlLM8WVE0P9NjAB4YV8vDYvbQBW211Fjhysh1p2GoD1isn rkw5T68c5V1les/mnamX5t1z3QVLi7ETdcC+sRAjzoufm30sSTQBMYn8thAbZYnyt/3G oB0+cqvAQISB/OMNrkvJKOEcxFO1pRYm9Q7GGwzTNkijMpeRUNIiTH7zVGyL2Z9KA7EW PJpw== X-Gm-Message-State: AA6/9RmfwR4bBXEKi0yTCCHtncmCCi2zFOBu7t6pKxgRVmymLldzYmIckckXdm+q+nDUwg== X-Received: by 10.28.51.18 with SMTP id z18mr6133690wmz.97.1477124092666; Sat, 22 Oct 2016 01:14:52 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id y3sm7061775wjg.3.2016.10.22.01.14.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Oct 2016 01:14:52 -0700 (PDT) From: Eryu Guan To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, agruenba@redhat.com, Eryu Guan Subject: [PATCH] CIFS: iterate over posix acl xattr entry correctly in ACL_to_cifs_posix() Date: Sat, 22 Oct 2016 16:14:40 +0800 Message-Id: <1477124080-27230-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 --- 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..d04c21c 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -3453,8 +3453,8 @@ 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)); + struct posix_acl_xattr_entry *ace = (void *)(local_acl + 1); + rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], &ace[i]); if (rc != 0) { /* ACE not converted */ break;