lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e9c3a7c20804172044u22aea1ccpee1eb02a88eca770@mail.gmail.com>
Date:	Thu, 17 Apr 2008 20:44:13 -0700
From:	"Dan Williams" <dan.j.williams@...el.com>
To:	"Andrew Morton" <akpm@...ux-foundation.org>
Cc:	"Greg KH" <greg@...ah.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	"Kay Sievers" <kay.sievers@...y.org>, linux-usb@...r.kernel.org
Subject: Re: [PATCH mm] sysfs: add /sys/dev/usb to handle CONFIG_USB_DEVICE_CLASS=y

On Thu, Apr 17, 2008 at 8:08 PM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Thu, 17 Apr 2008 19:11:03 -0700 Dan Williams <dan.j.williams@...el.com> wrote:
>
>  > The deprecated config option CONFIG_USB_DEVICE_CLASS causes class devices
>  > with duplicate major:minor numbers to be registered.  In effect they
>  > represent a usb specific address space for major:minor numbers so add 'usb'
>  > as a directory along side 'block' and 'char'.
>  >
>
>  hm.  That's a somewhat nasty patch you have there.
>

Yeah, it was a frantic unbreak -mm attempt more than anything else :(.

>
>  >
>  > diff --git a/drivers/base/core.c b/drivers/base/core.c
>  > index ba21118..bce5e4b 100644
>  > --- a/drivers/base/core.c
>  > +++ b/drivers/base/core.c
>  > @@ -30,6 +30,10 @@ int (*platform_notify_remove)(struct device *dev) = NULL;
>  >  static struct kobject *dev_kobj;
>  >  static struct kobject *char_kobj;
>  >  static struct kobject *block_kobj;
>  > +#ifdef CONFIG_USB_DEVICE_CLASS
>  > +extern struct class *usb_classdev_class;
>
>  This should be in a header file, but where?
>
>
>  > +static struct kobject *usb_kobj;
>  > +#endif
>  >
>  >  #ifdef CONFIG_BLOCK
>  >  static inline int device_is_not_partition(struct device *dev)
>  > @@ -764,7 +768,13 @@ static void device_remove_class_symlinks(struct device *dev)
>  >
>  >  static struct kobject *device_to_dev_kobj(struct device *dev)
>  >  {
>  > -     return dev->class == &block_class ? block_kobj : char_kobj;
>  > +     if (dev->class == &block_class)
>  > +             return block_kobj;
>
>  Does the existing code compile-n-work with CONFIG_BLOCK=n?
>

I'll take a look.  And Greg shares my suspicion that there might be
other duplicate devices like these USB class devices, so need to look
for that as well.

>
>  > +#ifdef CONFIG_USB_DEVICE_CLASS
>  > +     if (usb_classdev_class && dev->class == usb_classdev_class)
>  > +             return usb_kobj;
>  > +#endif
>
> > +#ifdef CONFIG_USB_DEVICE_CLASS
>  > +     usb_kobj = kobject_create_and_add("usb", dev_kobj);
>  > +     if (!usb_kobj)
>  > +             goto usb_kobj_err;
>  > +#endif
>
> > +#ifdef CONFIG_USB_DEVICE_CLASS
>  > + usb_kobj_err:
>  > +     kobject_put(char_kobj);
>  > +#endif
>
> > +#ifdef CONFIG_USB_DEVICE_CLASS
>  > +     kobject_put(usb_kobj);
>  > +#endif
>
>  mutter.  I'd have thought that with suitable fiddling most of this code
>  could be moved into the USB core and some of it (the
>  kobject_create_and_add()) can be done via USB's initcalls.
>
>  this:
>
>  --- a/drivers/base/core.c~sysfs-add-sys-dev-usb-to-handle-config_usb_device_class=y-fix
>  +++ a/drivers/base/core.c
>  @@ -31,7 +31,6 @@ static struct kobject *dev_kobj;
>
>  static struct kobject *char_kobj;
>   static struct kobject *block_kobj;
>   #ifdef CONFIG_USB_DEVICE_CLASS
>  -extern struct class *usb_classdev_class;
>   static struct kobject *usb_kobj;
>   #endif
>
>  diff -puN drivers/usb/core/devio.c~sysfs-add-sys-dev-usb-to-handle-config_usb_device_class=y-fix drivers/usb/core/devio.c
>  --- a/drivers/usb/core/devio.c~sysfs-add-sys-dev-usb-to-handle-config_usb_device_class=y-fix
>  +++ a/drivers/usb/core/devio.c
>  @@ -43,6 +43,7 @@
>   #include <linux/signal.h>
>   #include <linux/poll.h>
>   #include <linux/module.h>
>  +#include <linux/device.h>
>   #include <linux/usb.h>
>   #include <linux/usbdevice_fs.h>
>   #include <linux/cdev.h>
>  diff -puN include/linux/device.h~sysfs-add-sys-dev-usb-to-handle-config_usb_device_class=y-fix include/linux/device.h
>  --- a/include/linux/device.h~sysfs-add-sys-dev-usb-to-handle-config_usb_device_class=y-fix
>  +++ a/include/linux/device.h
>  @@ -623,4 +623,6 @@ extern const char *dev_driver_string(str
>   #define MODULE_ALIAS_CHARDEV_MAJOR(major) \
>         MODULE_ALIAS("char-major-" __stringify(major) "-*")
>
>
>  +extern struct class *usb_classdev_class;
>  +
>   #endif /* _DEVICE_H_ */
>  _
>
>  deworsens things slightly.
>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ