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:	Wed, 30 May 2007 11:58:22 +0200
From:	Christoph Hellwig <hch@....de>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	cbe-oss-dev@...abs.org, gregkh@...e.de,
	linux-kernel@...r.kernel.org
Subject: Re: [Cbe-oss-dev] [RFC] Cell: shutdown method for spu_sysdev_class

On Tue, May 29, 2007 at 08:23:49PM +0200, Arnd Bergmann wrote:
> On Sunday 06 May 2007, Geoff Levand wrote:
> > --- ps3-linux-dev.orig/arch/powerpc/platforms/cell/spu_base.c
> > +++ ps3-linux-dev/arch/powerpc/platforms/cell/spu_base.c
> > @@ -463,8 +463,21 @@ void spu_free(struct spu *spu)
> >  }
> >  EXPORT_SYMBOL_GPL(spu_free);
> >
> > +static int spu_shutdown(struct sys_device *sysdev)
> > +{
> > +       struct spu *spu = container_of(sysdev, struct spu, sysdev);
> > +
> > +       // what else here???
> > +
> > +       spu_free_irqs(spu);
> > +       spu_destroy_spu(spu);
> > +       kfree(spu);
> > +       return 0;
> > +}
> > +
> >  struct sysdev_class spu_sysdev_class = {
> > -       set_kset_name("spu")
> > +       set_kset_name("spu"),
> > +       .shutdown = spu_shutdown,
> >  };
> >
> >  int spu_add_sysdev_attr(struct sysdev_attribute *attr)
> 
> After some debugging, I found that this patch creates an oops when slab
> debugging is enabled, the reason for that being that sysdev_shutdown()
> iterates over all system devices using list_for_each_entry(), not
> list_for_each_entry_safe().
> 
> There are two ways of fixing this:
> 
> - use list_for_each_entry_safe() to go over all devices so they
>   can be freed in their ->shutdown method.
> - not free the device, because we know the system is going down
>   anyway.
> 
> Is it documented or implied somewhere that ->shutdown must not free
> the device? If not, the first option is probably the safer choice.

It's not documented anywhere, but implicitly assumed.  I don't know
of any shutdown implementation that frees the device.
-
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