Skip to contentSkip to conversation

tmpfs: Fix simple_set_acl()

PATCH In review Chuck Lever 2 participants 4 messages Apr 22, 2014 – May 5, 2014 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tmpfs: Fix simple_set_acl()

Ben Greear <[email protected]> reports that NFSD panics in posix_acl_equiv_mode() during an NFSv3 SETACL operation. I have reproduced this using an exported tmpfs and cthon04 with NFSv3.

A survey of .set_acl methods suggests that simple_set_acl() must tolerate a NULL "acl" argument.

Fixes feda821e76f3bbbba4bd54d30b4d4005a7848aa5

---

 fs/posix_acl.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
fs/posix_acl.c +7 -5
index 9e363e4..0b25aae 100644
@@ -863,11 +863,13 @@ int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 	int error;
 
 	if (type == ACL_TYPE_ACCESS) {
-		error = posix_acl_equiv_mode(acl, &inode->i_mode);
-		if (error < 0)
-			return 0;
-		if (error == 0)
-			acl = NULL;
+		if (acl) {
+			error = posix_acl_equiv_mode(acl, &inode->i_mode);
+			if (error < 0)
+				return 0;
+			if (error == 0)
+				acl = NULL;
+		}
 	}
 
 	inode->i_ctime = CURRENT_TIME;
#1 lore raw

This doesn't seem upstream--whose job is it to pick this up?

Maybe you could resend directly To: linus?

--b.

Quoted 42 lines · Chuck Lever

Ben Greear <[email protected]> reports that NFSD panics in posix_acl_equiv_mode() during an NFSv3 SETACL operation. I have reproduced this using an exported tmpfs and cthon04 with NFSv3.

A survey of .set_acl methods suggests that simple_set_acl() must tolerate a NULL "acl" argument.

Fixes feda821e76f3bbbba4bd54d30b4d4005a7848aa5

---

 fs/posix_acl.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
fs/posix_acl.c +7 -6
index 9e363e4..0b25aae 100644
@@ -863,11 +863,13 @@ int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 	int error;
 
 	if (type == ACL_TYPE_ACCESS) {
-		error = posix_acl_equiv_mode(acl, &inode->i_mode);
-		if (error < 0)
-			return 0;
-		if (error == 0)
-			acl = NULL;
+		if (acl) {
+			error = posix_acl_equiv_mode(acl, &inode->i_mode);
+			if (error < 0)
+				return 0;
+			if (error == 0)
+				acl = NULL;
+		}
 	}
 
 	inode->i_ctime = CURRENT_TIME;
 
--

To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi Bruce-

Quoted 3 lines · J. Bruce Fields

This doesn't seem upstream--whose job is it to pick this up?

Maybe you could resend directly To: linus?

Thanks for following up.

There was some discussion about it this week because the same issue arose for jfs as well.

Christoph has a broader solution: simply check for acl == NULL in posix_acl_equiv_mode(). The plan is then to remove that check from filesystem-specific .set_acl methods.

He posted a patch this morning, so I'm going to let him run this to ground.

Quoted 49 lines

--b.

Quoted 39 lines · Chuck Lever

Ben Greear <[email protected]> reports that NFSD panics in posix_acl_equiv_mode() during an NFSv3 SETACL operation. I have reproduced this using an exported tmpfs and cthon04 with NFSv3.

A survey of .set_acl methods suggests that simple_set_acl() must tolerate a NULL "acl" argument.

Fixes feda821e76f3bbbba4bd54d30b4d4005a7848aa5

---

fs/posix_acl.c | 12 +++++++-----

1 files changed, 7 insertions(+), 5 deletions(-)
fs/posix_acl.c +7 -6
index 9e363e4..0b25aae 100644
@@ -863,11 +863,13 @@ int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 	int error;
 
 	if (type == ACL_TYPE_ACCESS) {
-		error = posix_acl_equiv_mode(acl, &inode->i_mode);
-		if (error < 0)
-			return 0;
-		if (error == 0)
-			acl = NULL;
+		if (acl) {
+			error = posix_acl_equiv_mode(acl, &inode->i_mode);
+			if (error < 0)
+				return 0;
+			if (error == 0)
+				acl = NULL;
+		}
 	}
 
 	inode->i_ctime = CURRENT_TIME;
 
--
Quoted 3 lines

To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
#3 lore raw
Quoted 13 lines · Chuck Lever

Hi Bruce-

Quoted 3 lines · J. Bruce Fields

This doesn't seem upstream--whose job is it to pick this up?

Maybe you could resend directly To: linus?

Thanks for following up.

There was some discussion about it this week because the same issue arose for jfs as well.

Quoted 6 lines

Christoph has a broader solution: simply check for acl == NULL in posix_acl_equiv_mode(). The plan is then to remove that check from filesystem-specific .set_acl methods.

He posted a patch this morning, so I'm going to let him run this to ground.

OK, thanks.--b.