Re: [PATCH] memdup_user: introduce, fix

From: KOSAKI Motohiro
Date: Mon Mar 09 2009 - 21:53:48 EST


> * Include machine specific inline routines
> diff --git a/mm/util.c b/mm/util.c
> index 3d21c21..7c122e4 100644
> --- a/mm/util.c
> +++ b/mm/util.c
> @@ -74,15 +74,19 @@ EXPORT_SYMBOL(kmemdup);
> *
> * @src: source address in user space
> * @len: number of bytes to copy
> - * @gfp: GFP mask to use
> *
> * Returns an ERR_PTR() on failure.
> */
> -void *memdup_user(const void __user *src, size_t len, gfp_t gfp)
> +void *memdup_user(const void __user *src, size_t len)
> {
> void *p;
>
> - p = kmalloc_track_caller(len, gfp);
> + /*
> + * Always use GFP_KERNEL, since copy_from_user() can sleep and
> + * cause pagefault, which makes it pointless to use GFP_NOFS
> + * or GFP_ATOMIC.
> + */
> + p = kmalloc_track_caller(len, GFP_KERNEL);
> if (!p)
> return ERR_PTR(-ENOMEM);

ok. thanks.
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>



--
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/