Message ID | 20180531062111.374pq6lxrmdffun6@kili.mountain (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Thanks again. David, could you apply this on top of my v7 patch in for-next tree? Regards, Tomohiro Misono On 2018/05/31 15:21, Dan Carpenter wrote: > 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@oracle.com> > > 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, May 31, 2018 at 03:41:41PM +0900, Misono Tomohiro wrote:
> David, could you apply this on top of my v7 patch in for-next tree?
Done.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
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);
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@oracle.com> -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html