Skip to contentSkip to conversation

btrfs: add check for ERR_PTR()

PATCH New Dan Carpenter 1 participant 1 message Apr 21, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: add check for ERR_PTR()

posix_acl_from_xattr() can sometimes return an ERR_PTR().

fs/btrfs/acl.c +2 -1
index 6ef7b26..c6d84ce 100644
@@ -60,7 +60,8 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
 		size = __btrfs_getxattr(inode, name, value, size);
 		if (size > 0) {
 			acl = posix_acl_from_xattr(value, size);
-			set_cached_acl(inode, type, acl);
+			if (!IS_ERR(acl))
+				set_cached_acl(inode, type, acl);
 		}
 		kfree(value);
 	} else if (size = -ENOENT || size = -ENODATA || size = 0) {