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(
if (error)
return error;
if (bulkreq.ocount != NULL) {
if (copy_to_user(bulkreq.lastip, &inlast,
sizeof(xfs_ino_t)))
return -EFAULT;
if (bulkreq.lastip != NULL &&
copy_to_user(bulkreq.lastip, &inlast, sizeof(xfs_ino_t)))
return -EFAULT;
if (copy_to_user(bulkreq.ocount, &count, sizeof(count)))
return -EFAULT;
}
if (bulkreq.ocount != NULL &&
copy_to_user(bulkreq.ocount, &count, sizeof(count)))
return -EFAULT;
return 0;
}
......
......@@ -305,14 +305,13 @@ xfs_compat_ioc_bulkstat(
if (error)
return error;
if (bulkreq.ocount != NULL) {
if (copy_to_user(bulkreq.lastip, &inlast,
sizeof(xfs_ino_t)))
return -EFAULT;
if (bulkreq.lastip != NULL &&
copy_to_user(bulkreq.lastip, &inlast, sizeof(xfs_ino_t)))
return -EFAULT;
if (copy_to_user(bulkreq.ocount, &count, sizeof(count)))
return -EFAULT;
}
if (bulkreq.ocount != NULL &&
copy_to_user(bulkreq.ocount, &count, sizeof(count)))
return -EFAULT;
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