提交 f16fe3ec 编写于 作者: D 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: NDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: NBrian Foster <bfoster@redhat.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册