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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 16 Jan 2008 09:03:03 +0800
From:	"Dave Young" <hidave.darkstar@...il.com>
To:	"Jarek Poplawski" <jarkao2@...il.com>
Cc:	"Greg KH" <gregkh@...e.de>, stefanr@...6.in-berlin.de,
	david-b@...bell.net, stern@...land.harvard.edu,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 7/7] driver-core : convert semaphore to mutex in struct class

On Jan 15, 2008 9:56 PM, Jarek Poplawski <jarkao2@...il.com> wrote:
>
> On Tue, Jan 15, 2008 at 05:15:27PM +0800, Dave Young wrote:
> > Convert the class semaphore to mutex.
> >
> > Signed-off-by: Dave Young <hidave.darkstar@...il.com>
> >
> > ---
> >  drivers/base/class.c   |   38 +++++++++++++++++++-------------------
> >  drivers/base/core.c    |   18 ++++++++----------
> >  include/linux/device.h |    3 ++-
> >  3 files changed, 29 insertions(+), 30 deletions(-)
> >
> > diff -upr linux/drivers/base/class.c linux.new/drivers/base/class.c
> > --- linux/drivers/base/class.c        2008-01-15 14:04:26.000000000 +0800
> > +++ linux.new/drivers/base/class.c    2008-01-15 14:04:26.000000000 +0800
> > @@ -144,7 +144,7 @@ int class_register(struct class * cls)
> >       INIT_LIST_HEAD(&cls->devices);
> >       INIT_LIST_HEAD(&cls->interfaces);
> >       kset_init(&cls->class_dirs);
> > -     init_MUTEX(&cls->sem);
> > +     mutex_init(&cls->mutex);
> >       error = kobject_set_name(&cls->subsys.kobj, "%s", cls->name);
> >       if (error)
> >               return error;
> > @@ -617,13 +617,13 @@ int class_device_add(struct class_device
> >       kobject_uevent(&class_dev->kobj, KOBJ_ADD);
> >
> >       /* notify any interfaces this device is now here */
> > -     down(&parent_class->sem);
> > +     mutex_lock_nested(&parent_class->mutex, SINGLE_DEPTH_NESTING);
> >       list_add_tail(&class_dev->node, &parent_class->children);
> >       list_for_each_entry(class_intf, &parent_class->interfaces, node) {
> >               if (class_intf->add)
> >                       class_intf->add(class_dev, class_intf);
> >       }
> > -     up(&parent_class->sem);
> > +     mutex_unlock(&parent_class->mutex);
> >
> >       goto out1;
> >
> > @@ -725,12 +725,12 @@ void class_device_del(struct class_devic
> >       struct class_interface *class_intf;
> >
> >       if (parent_class) {
> > -             down(&parent_class->sem);
> > +             mutex_lock(&parent_class->mutex);
>
> I hope I'm wrong with this (I don't know this code at all...), and
> of course I should've noticed this earlier after all, but I wonder
> about this _NESTING corretness here. So, if these variables names
> are right, and say about real nesting dependency, then it seems
> mutex_lock_nested() should be used consistently even if (currently?)
> not forced by lockdep warnings; otherwise this could possibly cover
> some other warnings. Alas, if accidentally I'm right, it seems a
> bit of new testing would be necessary...

The lockdep warining was posted in the below thread, actually, I have
built and run this patced kernel for several days, there's no more
warnings.
http://lkml.org/lkml/2008/1/3/2

>
> Regards,
> Jarek P.
>
--
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