Re: goldfish driver: Missing get_user_pages ingoldfish_pipe_read_write()

From: Greg Kroah-Hartman
Date: Thu Jun 27 2013 - 13:46:58 EST


On Thu, Jun 27, 2013 at 01:35:32PM -0400, Mathieu Desnoyers wrote:
> The following code snippet:
>
> drivers/platform/goldfish/goldfish_pipe.c:
> goldfish_pipe_read_write()
>
> /* Ensure that the corresponding page is properly mapped */
> /* FIXME: this isn't safe or sufficient - use get_user_pages */
> if (is_write) {
> char c;
> /* Ensure that the page is mapped and readable */
> if (__get_user(c, (char __user *)address)) {
> if (!ret)
> ret = -EFAULT;
> break;
> }
> } else {
> /* Ensure that the page is mapped and writable */
> if (__put_user(0, (char __user *)address)) {
> if (!ret)
> ret = -EFAULT;
> break;
> }
> }
>
> Seems to lack the kind of validation required to make it fail properly
> if the memory range is not fully populated.

This is an emulated platform only, so it's probably not a big deal,
right?

> I see that this feature has been merged in Linux kernel 3.9, but the
> FIXME is still there in 3.10-rc7. Any plans on fixing this ?

It would be good to get fixed, but probably way down on the priority
list.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/