Skip to contentSkip to conversation

hotplug and granting permissions

DISCUSSION Oliver Neukum 1 participant 1 message Oct 12, 2002

lore
Share & tools
lore
#0 lore raw

Am Samstag, 12. Oktober 2002 07:55 schrieb Greg KH:

Quoted 6 lines · Oliver Neukum
Quoted 5 lines

Am Freitag, 11. Oktober 2002 23:43 schrieb Alan Cox:

Quoted 4 lines · Oliver Neukum
Quoted 2 lines

That is not true. Hotplugging changes it. By assigning new devices to existing device nodes, the kernel _does_ hand out permissions.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Only if you got the design wrong. The kernel should pass hotplug the info to create the device nodes.

Then you need a very large number of device numbers.

What? No you don't. But who cares, I'll get random device number generation into the kernel eventually...

This won't help. You need a counter. As Alan has pointed out to us lesser mortals, the problem is reuse. Therefore you need several times the maximum number of devices on a bus to make this scheme work. Under these circumstances (20 bit minors) it's indeed the easiest solution. IMHO quick and dirty, but this is a matter of personal taste. If you use random generation you'd have to keep a record of previously used numbers.

Quoted 1 line

And this is off topic for this thread :)

Yes. And for this list. Therefore I changed topic and list.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

If you are dealing with a device where a node might be reused, yes you might want to store a generation count and return -EIO if the handle has a mismatched generation count.

Quoted 8 lines
Quoted 5 lines

That you can only do if you have a handle. In which case the problem is easy. But open() takes only a name. You cannot sanely put a generation count into that.
IMHO if you reuse device nodes, you have to reset permissions on them in kernel space.

Nope, not going to happen. But I'll save this discussion for later, whenever we get enough code into the kernel to be worrying about this.

We have code in the kernel that causes this. And it's bad to add stuff before we know how to make it work properly.

Regards
Oliver

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel