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]
Date:	Mon, 13 May 2013 17:04:15 +0200
From:	Takashi Iwai <tiwai@...e.de>
To:	Ming Lei <ming.lei@...onical.com>
Cc:	linux-kernel@...r.kernel.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 1/3] firmware: Avoid superfluous usermodehelper lock

At Sun, 12 May 2013 21:59:51 +0800,
Ming Lei wrote:
> 
> On Thu, May 9, 2013 at 1:51 AM, Takashi Iwai <tiwai@...e.de> wrote:
> >
> > ---
> > From: Takashi Iwai <tiwai@...e.de>
> > Subject: [PATCH v2] firmware: Avoid deadlock of usermodehelper lock at shutdown
> >
> > When a system goes to reboot/shutdown, it tries to disable the
> > usermode helper via usermodehelper_disable().  This might be blocked
> > when a driver tries to load a firmware beforehand and it's stuck by
> > some reason.
> >
> > In this patch, the firmware class driver registers a reboot notifier
> > so that it can abort all pending f/w bufs.  Also enable a flag for
> > avoiding the call of usermodehelper after the reboot/shutdown starts.
> >
> > Signed-off-by: Takashi Iwai <tiwai@...e.de>
> > ---
> >  drivers/base/firmware_class.c | 40 +++++++++++++++++++++++++++++++++-------
> >  1 file changed, 33 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> > index 4b1f926..972e535 100644
> > --- a/drivers/base/firmware_class.c
> > +++ b/drivers/base/firmware_class.c
> > @@ -27,6 +27,7 @@
> >  #include <linux/pm.h>
> >  #include <linux/suspend.h>
> >  #include <linux/syscore_ops.h>
> > +#include <linux/reboot.h>
> >
> >  #include <generated/utsrelease.h>
> >
> > @@ -171,6 +172,7 @@ static struct firmware_buf *__allocate_fw_buf(const char *fw_name,
> >         strcpy(buf->fw_id, fw_name);
> >         buf->fwc = fwc;
> >         init_completion(&buf->completion);
> > +       INIT_LIST_HEAD(&buf->list);
> 
> You should introduce one extra field(such as, 'list_abort') in
> 'struct firmware_buf' and the field of 'list' is for firmware caching now.

Yeah, the current code messes it up.  Sorry for not resending the
right version.  I thought it won't conflict but it seems it doesn't
work as is.  (At least, list_add() would need to be replaced with
list_move()).

> Also, INIT_LIST_HEAD isn't needed here.

Well, I'd recommend to avoid such a mini optimization unless it's
really a hot path.  It may bite you in the end...


thanks,

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