vfio: fix ioctl error handling

[ Upstream commit 8160c4e455 ]

Calling return copy_to_user(...) in an ioctl will not
do the right thing if there's a pagefault:
copy_to_user returns the number of bytes not copied
in this case.

Fix up vfio to do
	return copy_to_user(...)) ?
		-EFAULT : 0;

everywhere.

Cc: stable@vger.kernel.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
This commit is contained in:
Michael S. Tsirkin 2016-02-28 16:31:39 +02:00 • committed by Sasha Levin
commit bad24c7e02
2 changed files with 10 additions and 5 deletions