Re: [PATCH] usb: use memdup_user()
From: Oliver Neukum
Date: Tue May 05 2009 - 04:51:01 EST
Am Montag, 4. Mai 2009 16:53:48 schrieb Greg KH:
> > On Mon, May 4, 2009 at 10:02 AM, David Brownell <david-b@xxxxxxxxxxx>
wrote:
> > > Unless it's incorrect to use that, I have to say that it
> > > makes more sense to use that utility than recreate it by
> > > open-coding...
> >
> > Yup, and I don't really see how anyone can avoid "thinking about a new
> > primitive" anyway. We have it in the kernel now and surely it will
> > appear under drivers/usb/ sooner or later...
>
> Well, how about passing the GPF flags down to memdup_user() so that we
> can use it in the usb subsystem, and Oliver's complaint will be resolve?
It would always be GFP_KERNEL. Unless you can use GFP_KERNEL you must
not use copy_to/from_user. It would not make sense for all other users of that
API. I don't think that the API as such is bad, just that USB needs extra care
with memory allocations (and user memory access)
We are limited to GFP_NOIO during pre/post_reset and suspend/resume
and while we hold any locks these methods take. This is not simple and
people need to be reminded.
Regards
Oliver
--
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/