memdup_user() returns error pointers, it doesn't return NULL.
Fixes: 01141b08dee5 ("btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index ff5018587bd9..d8dd4504bdab 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2791,9 +2791,9 @@ static noinline int btrfs_ioctl_get_subvol_rootref(struct file *file,
return -ENOMEM;
rootrefs = memdup_user(argp, sizeof(*rootrefs));
- if (!rootrefs) {
+ if (IS_ERR(rootrefs)) {
btrfs_free_path(path);
- return -ENOMEM;
+ return PTR_ERR(rootrefs);
}
inode = file_inode(file);
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html