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: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
This commit is contained in:
parent
ebd126a651
commit
f16fe3ecde
|
@ -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 &&
|
||||||
|
copy_to_user(bulkreq.ocount, &count, sizeof(count)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 &&
|
||||||
|
copy_to_user(bulkreq.ocount, &count, sizeof(count)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue