Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -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)))
	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)))
	if (bulkreq.ocount != NULL &&
	    copy_to_user(bulkreq.ocount, &count, sizeof(count)))
		return -EFAULT;
	}

	return 0;
}
+6 −7
Original line number Diff line number Diff line
@@ -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)))
	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)))
	if (bulkreq.ocount != NULL &&
	    copy_to_user(bulkreq.ocount, &count, sizeof(count)))
		return -EFAULT;
	}

	return 0;
}