linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cifs: Fix chmod with modefromsid when an older ACE already exists.
@ 2021-03-26 12:11 Shyam Prasad N
  2021-03-26 15:51 ` Aurélien Aptel
  0 siblings, 1 reply; 5+ messages in thread
From: Shyam Prasad N @ 2021-03-26 12:11 UTC (permalink / raw)
  To: Steve French, CIFS

[-- Attachment #1: Type: text/plain, Size: 159 bytes --]

Found a regression in modefromsid with my last fix in cifsacl.
Tested against mode check tests for both cifsacl and modefromsid this time.

-- 
Regards,
Shyam

[-- Attachment #2: 0001-cifs-Fix-chmod-with-modefromsid-when-an-older-ACE-al.patch --]
[-- Type: application/octet-stream, Size: 1245 bytes --]

From df12f866d57ec57d8e24ee9217d878b975128aa5 Mon Sep 17 00:00:00 2001
From: Shyam Prasad N <sprasad@microsoft.com>
Date: Fri, 26 Mar 2021 10:28:16 +0000
Subject: [PATCH] cifs: Fix chmod with modefromsid when an older ACE already
 exists.

My recent fixes to cifsacl to maintain inherited ACEs had
regressed modefromsid when an older ACL already exists.

The cifsacl fix that caused this regression:
cifs: Retain old ACEs when converting between mode bits and ACL.

Fixing it here.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
 fs/cifs/cifsacl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 2be22a5c690f..d178cf85e926 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -1130,8 +1130,7 @@ static int set_chmod_dacl(struct cifs_acl *pdacl, struct cifs_acl *pndacl,
 		}
 
 		/* If it's any one of the ACE we're replacing, skip! */
-		if (!mode_from_sid &&
-				((compare_sids(&pntace->sid, &sid_unix_NFS_mode) == 0) ||
+		if (((compare_sids(&pntace->sid, &sid_unix_NFS_mode) == 0) ||
 				(compare_sids(&pntace->sid, pownersid) == 0) ||
 				(compare_sids(&pntace->sid, pgrpsid) == 0) ||
 				(compare_sids(&pntace->sid, &sid_everyone) == 0) ||
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: cifs: Fix chmod with modefromsid when an older ACE already exists.
  2021-03-26 12:11 cifs: Fix chmod with modefromsid when an older ACE already exists Shyam Prasad N
@ 2021-03-26 15:51 ` Aurélien Aptel
  2021-03-26 15:54   ` Steve French
  2021-03-26 16:10   ` Paulo Alcantara
  0 siblings, 2 replies; 5+ messages in thread
From: Aurélien Aptel @ 2021-03-26 15:51 UTC (permalink / raw)
  To: Shyam Prasad N, Steve French, CIFS

Shyam Prasad N <nspmangalore@gmail.com> writes:
> Found a regression in modefromsid with my last fix in cifsacl.
> Tested against mode check tests for both cifsacl and modefromsid this time.

Can you put a Fixes tag?

Cheers,
-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cifs: Fix chmod with modefromsid when an older ACE already exists.
  2021-03-26 15:51 ` Aurélien Aptel
@ 2021-03-26 15:54   ` Steve French
  2021-03-26 16:08     ` Steve French
  2021-03-26 16:10   ` Paulo Alcantara
  1 sibling, 1 reply; 5+ messages in thread
From: Steve French @ 2021-03-26 15:54 UTC (permalink / raw)
  To: Aurélien Aptel; +Cc: Shyam Prasad N, CIFS

Presumably:

commit 5171317dfd9afcf729799d31fffdbb9e71e45402
Author: Shyam Prasad N <sprasad@microsoft.com>
Date:   Wed Mar 10 10:22:27 2021 +0000

    cifs: update new ACE pointer after populate_new_aces.

On Fri, Mar 26, 2021 at 10:51 AM Aurélien Aptel <aaptel@suse.com> wrote:
>
> Shyam Prasad N <nspmangalore@gmail.com> writes:
> > Found a regression in modefromsid with my last fix in cifsacl.
> > Tested against mode check tests for both cifsacl and modefromsid this time.
>
> Can you put a Fixes tag?
>
> Cheers,
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cifs: Fix chmod with modefromsid when an older ACE already exists.
  2021-03-26 15:54   ` Steve French
@ 2021-03-26 16:08     ` Steve French
  0 siblings, 0 replies; 5+ messages in thread
From: Steve French @ 2021-03-26 16:08 UTC (permalink / raw)
  To: Aurélien Aptel; +Cc: Shyam Prasad N, CIFS

[-- Attachment #1: Type: text/plain, Size: 1093 bytes --]

Sorry that was the wrong "Fixes" - it was "Retain old ACEs when converting..."

I added a Fixes tag


On Fri, Mar 26, 2021 at 10:54 AM Steve French <smfrench@gmail.com> wrote:
>
> Presumably:
>
> commit 5171317dfd9afcf729799d31fffdbb9e71e45402
> Author: Shyam Prasad N <sprasad@microsoft.com>
> Date:   Wed Mar 10 10:22:27 2021 +0000
>
>     cifs: update new ACE pointer after populate_new_aces.
>
> On Fri, Mar 26, 2021 at 10:51 AM Aurélien Aptel <aaptel@suse.com> wrote:
> >
> > Shyam Prasad N <nspmangalore@gmail.com> writes:
> > > Found a regression in modefromsid with my last fix in cifsacl.
> > > Tested against mode check tests for both cifsacl and modefromsid this time.
> >
> > Can you put a Fixes tag?
> >
> > Cheers,
> > --
> > Aurélien Aptel / SUSE Labs Samba Team
> > GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> > SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> > GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
> >
>
>
> --
> Thanks,
>
> Steve



-- 
Thanks,

Steve

[-- Attachment #2: 0001-cifs-Fix-chmod-with-modefromsid-when-an-older-ACE-al.patch --]
[-- Type: text/x-patch, Size: 1316 bytes --]

From 455637dd2e976ec8a8fff12f56a4b92115296696 Mon Sep 17 00:00:00 2001
From: Shyam Prasad N <sprasad@microsoft.com>
Date: Fri, 26 Mar 2021 10:28:16 +0000
Subject: [PATCH] cifs: Fix chmod with modefromsid when an older ACE already
 exists.

My recent fixes to cifsacl to maintain inherited ACEs had
regressed modefromsid when an older ACL already exists.

Found testing xfstest 495 with modefromsid mount option

Fixes: f5065508897a ("cifs: Retain old ACEs when converting between mode bits and ACL")

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/cifsacl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 2be22a5c690f..d178cf85e926 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -1130,8 +1130,7 @@ static int set_chmod_dacl(struct cifs_acl *pdacl, struct cifs_acl *pndacl,
 		}
 
 		/* If it's any one of the ACE we're replacing, skip! */
-		if (!mode_from_sid &&
-				((compare_sids(&pntace->sid, &sid_unix_NFS_mode) == 0) ||
+		if (((compare_sids(&pntace->sid, &sid_unix_NFS_mode) == 0) ||
 				(compare_sids(&pntace->sid, pownersid) == 0) ||
 				(compare_sids(&pntace->sid, pgrpsid) == 0) ||
 				(compare_sids(&pntace->sid, &sid_everyone) == 0) ||
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: cifs: Fix chmod with modefromsid when an older ACE already exists.
  2021-03-26 15:51 ` Aurélien Aptel
  2021-03-26 15:54   ` Steve French
@ 2021-03-26 16:10   ` Paulo Alcantara
  1 sibling, 0 replies; 5+ messages in thread
From: Paulo Alcantara @ 2021-03-26 16:10 UTC (permalink / raw)
  To: Aurélien Aptel, Shyam Prasad N, Steve French, CIFS

Aurélien Aptel <aaptel@suse.com> writes:

> Shyam Prasad N <nspmangalore@gmail.com> writes:
>> Found a regression in modefromsid with my last fix in cifsacl.
>> Tested against mode check tests for both cifsacl and modefromsid this time.
>
> Can you put a Fixes tag?

Agreed.  With that,

Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-26 16:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 12:11 cifs: Fix chmod with modefromsid when an older ACE already exists Shyam Prasad N
2021-03-26 15:51 ` Aurélien Aptel
2021-03-26 15:54   ` Steve French
2021-03-26 16:08     ` Steve French
2021-03-26 16:10   ` Paulo Alcantara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).