> It could (nearly) be replaced with nothing at all.  There is
> little benefit though.  In usbdev_open, the BKL is only
> being used to protect dev->filelist, even if at first it seems
> that it is protecting against a race with disconnect -
> namely the possibility of dev being changed to null under
> you.  Why is there no race with disconnect?  Because
> the disconnect code holds the BKL and usbdev_open
> does not sleep (after the kmalloc at least; good catch
> by the way).  So the value of dev does not change.  So
> what is the BKL being used for?  As far as I can see it is
> being used to serialize access to dev->filelist and that is
> all.  Usually a spin lock is used for such tasks, but hey!
> this is not a critical code path.

So in your oppinion, the patch should be applied?

        Regards
                Oliver

PS: Greg, here it is for your benefit again,
should you want to apply it

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[EMAIL PROTECTED], 2002-12-08 13:42:36+01:00, [EMAIL PROTECTED]
  - fix race between disconnect and usbdev_open


 devio.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)


diff -Nru a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
--- a/drivers/usb/core/devio.c  Sun Dec  8 13:44:21 2002
+++ b/drivers/usb/core/devio.c  Sun Dec  8 13:44:21 2002
@@ -484,14 +484,17 @@
         * and the hub thread have the kernel lock
         * (still acquire the kernel lock for safety)
         */
+       ret = -ENOMEM;
+       if (!(ps = kmalloc(sizeof(struct dev_state), GFP_KERNEL)))
+               goto out_nolock;
+
        lock_kernel();
        ret = -ENOENT;
        dev = inode->u.generic_ip;
-       if (!dev)
-               goto out;
-       ret = -ENOMEM;
-       if (!(ps = kmalloc(sizeof(struct dev_state), GFP_KERNEL)))
+       if (!dev) {
+               kfree(ps);
                goto out;
+       }
        ret = 0;
        ps->dev = dev;
        ps->file = file;
@@ -509,6 +512,7 @@
        file->private_data = ps;
  out:
        unlock_kernel();
+ out_nolock:
         return ret;
 }
 

===================================================================


This BitKeeper patch contains the following changesets:
1.1084
## Wrapped with gzip_uu ##


begin 664 bkpatch5819
M'XL(`*4^\ST``[V546_;-A#'G\U/<4-?8G262(J2*`<NTK1N&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>"Q*_P<`````
`
end



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to