Am Mittwoch, 14. April 2004 13:37 schrieb Duncan Sands:
> On Wednesday 14 April 2004 13:04, Oliver Neukum wrote:
> > > + down_read(&usb_bus_type.subsys.rwsem);
> > > + if (interface && interface->dev.driver) {
> > > +         strncpy(gd.driver, interface->dev.driver->name, sizeof(gd.driver));
> > > +         ret = copy_to_user(arg, &gd, sizeof(gd)) ? -EFAULT : 0;
> > > + }
> > > + up_read(&usb_bus_type.subsys.rwsem);
> > > + return ret;
> >
> > IMHO you should drop the lock before you copy to userspace.
>
> Hi Oliver, I wasn't particularly worried about it since it's a rwsem taken
> for reading and writing is a rare event.  Do you think it really matters? 
> If so, how about this instead (compiles but otherwise untested):

Hi,

I expect it to rarely matter, but it might matter now and then. It's
just a question of hygiene. If you are using a temporary buffer I'd
like to see it used to full advantage. So either drop the lock or do
a direct copy. I'd prefer the first option your patch implemented.

        Regards
                Oliver



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to