Re: [linux-usb-devel] [PATCH 8/9] USB usbfs: missing lock in proc_getdriver

From: Duncan Sands (baldrick_at_free.fr)
Date: 04/14/04

  • Next message: Matthew Wilcox: "Re: [PATCH] sort out CLOCK_TICK_RATE usage, 2nd try [0/3]"
    To: Oliver Neukum <oliver@neukum.org>, Greg KH <greg@kroah.com>
    Date:	Wed, 14 Apr 2004 16:04:57 +0200
    
    

    Hi Oliver,

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

    I agree. Greg, please consider applying the updated patch:

    --- gregkh-2.6/drivers/usb/core/devio.c.orig 2004-04-14 16:02:44.000000000 +0200
    +++ gregkh-2.6/drivers/usb/core/devio.c 2004-04-14 16:03:12.000000000 +0200
    @@ -702,13 +708,15 @@
                     return -EFAULT;
             if ((ret = findintfif(ps->dev, gd.interface)) < 0)
                     return ret;
    + down_read(&usb_bus_type.subsys.rwsem);
             interface = ps->dev->actconfig->interface[ret];
    - if (!interface->dev.driver)
    + if (!interface || !interface->dev.driver) {
    + up_read(&usb_bus_type.subsys.rwsem);
                     return -ENODATA;
    + }
             strncpy(gd.driver, interface->dev.driver->name, sizeof(gd.driver));
    - if (copy_to_user(arg, &gd, sizeof(gd)))
    - return -EFAULT;
    - return 0;
    + up_read(&usb_bus_type.subsys.rwsem);
    + return copy_to_user(arg, &gd, sizeof(gd)) ? -EFAULT : 0;
     }
     
     static int proc_connectinfo(struct dev_state *ps, void __user *arg)

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


  • Next message: Matthew Wilcox: "Re: [PATCH] sort out CLOCK_TICK_RATE usage, 2nd try [0/3]"

    Relevant Pages

    • Re: [parisc-linux] Re: [PATCH 3/9] mm: parisc pte atomicity
      ... using your own tmpalias area sounds much better than getting ... I've simply not wrapped my head around the races, ... it looks like we agree that my patch is necessary and valid as is; ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: keyboard - was: Re: Linux 2.6.0-test4
      ... >> I was able to get the key unstuck by switching back and forth between ... I rebuild my kernel including your patch; ... I'll get back to you once I verify that the problem doesn't occur ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.6.0-test8/test9 io scheduler needs tuning?
      ... interactivity with regard to desktop use. ... Going to improve the time info output of the ddd loops to get better data and ... with the patch the hang reported earlier was not encountered again so ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [CFT][PATCH] 2.6.4-rc1 remove x86 boot page tables
      ... > For VISWS I think you actually need to turn paging off explicitly. ... The patch will need a few tweaks but it should be fairly straight forward. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] clarify message and give support contact for non-GPL modules
      ... The author of the second module ... So here is another attempt at the patch. ... send the line "unsubscribe linux-kernel" in ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
      (Linux-Kernel)