Skip to contentSkip to conversation

catch acl==NULL in __jfs_set_acl (fixed null pointer dereference)

PATCH Superseded Marco Munderloh 1 participant 1 message Apr 29, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 catch acl==NULL in __jfs_set_acl (fixed null pointer dereference)

__jfs_set_acl() does not check for acl being NULL

In my case, the kernel null pointer dereference occurs when exporting jfs over nfs3. Accessing the nfs causes a crash of the nfsd and corrupted files, probably as a clean unmount is not possible.

fs/jfs/acl.c +9 -7
@@ -83,13 +83,15 @@
 	switch (type) {
 	case ACL_TYPE_ACCESS:
 		ea_name = POSIX_ACL_XATTR_ACCESS;
-		rc = posix_acl_equiv_mode(acl, &inode->i_mode);
-		if (rc < 0)
-			return rc;
-		inode->i_ctime = CURRENT_TIME;
-		mark_inode_dirty(inode);
-		if (rc == 0)
-			acl = NULL;
+		if( acl ) {
+			rc = posix_acl_equiv_mode(acl, &inode->i_mode);
+			if (rc < 0)
+				return rc;
+			inode->i_ctime = CURRENT_TIME;
+			mark_inode_dirty(inode);
+			if (rc == 0)
+				acl = NULL;
+		}
 		break;
 	case ACL_TYPE_DEFAULT:
 		ea_name = POSIX_ACL_XATTR_DEFAULT;