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:	Thu, 19 Apr 2007 14:51:33 +0200
From:	Cornelia Huck <cornelia.huck@...ibm.com>
To:	"Dmitry Torokhov" <dmitry.torokhov@...il.com>
Cc:	"Tejun Heo" <htejun@...il.com>,
	"Alan Stern" <stern@...land.harvard.edu>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	"Greg K-H" <greg@...ah.com>,
	"Rusty Russell" <rusty@...tcorp.com.au>
Subject: Re: [PATCH RFD] alternative kobject release wait mechanism

On Wed, 18 Apr 2007 12:41:36 -0400,
"Dmitry Torokhov" <dmitry.torokhov@...il.com> wrote:

> I am still do not understand why this is needed. Would it not be
> simplier just to use a reference to struct device instead of embedding
> it in a larger structure if their lifetimes are different and one does
> not have a subsystem that takes care of releasing logic.

Why are their lifetimes different? Usually, if I hold on to the device,
I also want to be able to use the structure that embeds the device.
 
> Pretty much drivers have 2 options:
> 
> struct my_device {
>         void *private_data;
>         struct device dev;
> };
> 
> In this case ->release must live in a subsystem code; individual
> drivers kfree(my_dev->private) and do any additional cleanup after
> calling device_unregister(&my_dev->dev);

They must do this in the ->remove callback.

> 
> Second option:
> 
> struct my_device {
>         type member1;
>         type member2;
> 
>        struct device *dev;
> };
> 
> dev is coming from _device_create(). Driver core takes care of
> releasing dev structure; driver does cleanup of my_device.

device_create() would need to not expect a class then, or it's not
universally usable. Also, the driver would need a method to get back
from the device to my_device. We're practically back at the first
option again, only that now the ->release function is sitting in the
driver core instead of the subsystem.

> With current sysfs orphaning attributes upon removal request there is
> no issue of accessing driver-private data through references obtained
> via ether embedded or referenced dev structure so everything is fine.

Discoupling of sysfs and kobject lifetime rules definetly eliminates a
lot of issues.
-
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