Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[linux-2.6-block.git] / fs / xfs / xfs_ioctl.c
index 6f7848cd5527bc8d32c840c44d4748a1422357fb..d58f0d6a699e672cfec235a02d8f032051f4facc 100644 (file)
@@ -67,7 +67,7 @@ xfs_find_handle(
                        return -EBADF;
                inode = file_inode(f.file);
        } else {
-               error = user_lpath((const char __user *)hreq->path, &path);
+               error = user_path_at(AT_FDCWD, hreq->path, 0, &path);
                if (error)
                        return error;
                inode = d_inode(path.dentry);
@@ -396,7 +396,7 @@ xfs_attrlist_by_handle(
        if (IS_ERR(dentry))
                return PTR_ERR(dentry);
 
-       kbuf = kmem_zalloc_large(al_hreq.buflen, KM_SLEEP);
+       kbuf = kmem_zalloc_large(al_hreq.buflen, 0);
        if (!kbuf)
                goto out_dput;
 
@@ -434,11 +434,11 @@ xfs_attrmulti_attr_get(
 
        if (*len > XFS_XATTR_SIZE_MAX)
                return -EINVAL;
-       kbuf = kmem_zalloc_large(*len, KM_SLEEP);
+       kbuf = kmem_zalloc_large(*len, 0);
        if (!kbuf)
                return -ENOMEM;
 
-       error = xfs_attr_get(XFS_I(inode), name, kbuf, (int *)len, flags);
+       error = xfs_attr_get(XFS_I(inode), name, &kbuf, (int *)len, flags);
        if (error)
                goto out_kfree;
 
@@ -831,7 +831,7 @@ xfs_bulkstat_fmt(
 /*
  * Check the incoming bulk request @hdr from userspace and initialize the
  * internal @breq bulk request appropriately.  Returns 0 if the bulk request
- * should proceed; XFS_ITER_ABORT if there's nothing to do; or the usual
+ * should proceed; -ECANCELED if there's nothing to do; or the usual
  * negative error code.
  */
 static int
@@ -889,13 +889,13 @@ xfs_bulk_ireq_setup(
 
                /* Asking for an inode past the end of the AG?  We're done! */
                if (XFS_INO_TO_AGNO(mp, breq->startino) > hdr->agno)
-                       return XFS_ITER_ABORT;
+                       return -ECANCELED;
        } else if (hdr->agno)
                return -EINVAL;
 
        /* Asking for an inode past the end of the FS?  We're done! */
        if (XFS_INO_TO_AGNO(mp, breq->startino) >= mp->m_sb.sb_agcount)
-               return XFS_ITER_ABORT;
+               return -ECANCELED;
 
        return 0;
 }
@@ -936,7 +936,7 @@ xfs_ioc_bulkstat(
                return -EFAULT;
 
        error = xfs_bulk_ireq_setup(mp, &hdr, &breq, arg->bulkstat);
-       if (error == XFS_ITER_ABORT)
+       if (error == -ECANCELED)
                goto out_teardown;
        if (error < 0)
                return error;
@@ -986,7 +986,7 @@ xfs_ioc_inumbers(
                return -EFAULT;
 
        error = xfs_bulk_ireq_setup(mp, &hdr, &breq, arg->inumbers);
-       if (error == XFS_ITER_ABORT)
+       if (error == -ECANCELED)
                goto out_teardown;
        if (error < 0)
                return error;
@@ -1038,6 +1038,10 @@ xfs_ioc_ag_geometry(
 
        if (copy_from_user(&ageo, arg, sizeof(ageo)))
                return -EFAULT;
+       if (ageo.ag_flags)
+               return -EINVAL;
+       if (memchr_inv(&ageo.ag_reserved, 0, sizeof(ageo.ag_reserved)))
+               return -EINVAL;
 
        error = xfs_ag_get_geometry(mp, ageo.ag_number, &ageo);
        if (error)
@@ -1309,8 +1313,7 @@ xfs_ioctl_setattr_dax_invalidate(
        if (fa->fsx_xflags & FS_XFLAG_DAX) {
                if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
                        return -EINVAL;
-               if (S_ISREG(inode->i_mode) &&
-                   !bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)),
+               if (!bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)),
                                sb->s_blocksize))
                        return -EINVAL;
        }
@@ -1881,7 +1884,7 @@ xfs_ioc_getfsmap(
        info.mp = ip->i_mount;
        info.data = arg;
        error = xfs_getfsmap(ip->i_mount, &xhead, xfs_getfsmap_format, &info);
-       if (error == XFS_BTREE_QUERY_RANGE_ABORT) {
+       if (error == -ECANCELED) {
                error = 0;
                aborted = true;
        } else if (error)