Commit f16fe3ec authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: bulkstat should copy lastip whenever userspace supplies one

When userspace passes in a @lastip pointer we should copy the results
back, even if the @ocount pointer is NULL.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
parent ebd126a6
...@@ -759,14 +759,13 @@ xfs_ioc_bulkstat( ...@@ -759,14 +759,13 @@ xfs_ioc_bulkstat(
if (error) if (error)
return error; return error;
if (bulkreq.ocount != NULL) { if (bulkreq.lastip != NULL &&
if (copy_to_user(bulkreq.lastip, &inlast, copy_to_user(bulkreq.lastip, &inlast, sizeof(xfs_ino_t)))
sizeof(xfs_ino_t))) return -EFAULT;
return -EFAULT;
if (copy_to_user(bulkreq.ocount, &count, sizeof(count))) if (bulkreq.ocount != NULL &&
return -EFAULT; copy_to_user(bulkreq.ocount, &count, sizeof(count)))
} return -EFAULT;
return 0; return 0;
} }
......
...@@ -305,14 +305,13 @@ xfs_compat_ioc_bulkstat( ...@@ -305,14 +305,13 @@ xfs_compat_ioc_bulkstat(
if (error) if (error)
return error; return error;
if (bulkreq.ocount != NULL) { if (bulkreq.lastip != NULL &&
if (copy_to_user(bulkreq.lastip, &inlast, copy_to_user(bulkreq.lastip, &inlast, sizeof(xfs_ino_t)))
sizeof(xfs_ino_t))) return -EFAULT;
return -EFAULT;
if (copy_to_user(bulkreq.ocount, &count, sizeof(count))) if (bulkreq.ocount != NULL &&
return -EFAULT; copy_to_user(bulkreq.ocount, &count, sizeof(count)))
} return -EFAULT;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment