linux-stable/drivers/platform/goldfish
Christoffer Dall 2f3be88237 goldfish_pipe: Pin pages to memory while copying and other cleanups
The existing code had a troubling TODO statement concerning the fact
that it just did a check if the page that the QEMU backend was going to
read from / write to was there before the call to the QEMU backend and
then relying on the fact that the page stayed around, even in a
preemptible SMP kernel.  Obviously the page could go away or be
reassigned, and strange things may happen.

Further, writes were not tracked, so any use of COW or KSM-like
features would break completely.  Probably that was never used by adbd
(the only current active user of the pipe), but could prove much more
dangerous for the GPU passthrough mechanism.

Instead, use get_user_pages() as the comment suggested and cleanup the
error path and add the set_page_dirt() call on a successful read
operation.

Also clarify the count used to return from successful read/write calls
and use Linux style commentary in various places of the file.

Note: The "just ignore error and return whatever we read so far" error
handling is really quite horrific.  I cannot change it without a more
careful study of all user space ABIs reliance on this 'feature'.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 23:34:36 -08:00
..
goldfish_pipe.c goldfish_pipe: Pin pages to memory while copying and other cleanups 2016-01-28 23:34:36 -08:00
Kconfig goldfish: refactor goldfish platform configs 2016-01-28 23:34:36 -08:00
Makefile goldfish: refactor goldfish platform configs 2016-01-28 23:34:36 -08:00
pdev_bus.c drivers/platform: Convert non-modular pdev_bus to use builtin_platform_driver 2015-06-16 14:12:38 -04:00