Re: [PATCH 0/2] libudev: Get all sysfs attrs for a device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kay Sievers [2011-03-03 15:11 +0100]:
> Keep in mind, that if you are root, you can do really nasty things if
> you open/read binary files. Sysfs is not meant to be used to blindly
> open "random" files. Think of it as device ioctl()s -- nobody would
> expect to just issue all numbers to a device, to check what comes back
> :) Things can go very wrong here.

The current patches don't actually open the attribute files, just read
the dir and stat the files; but I guess that was meant as a general
"never try to iterate over all of them" warning.

> The same code is used by udevd. For performance reasons, we can not
> afford to call readdir() for every device we look at. We don't want to
> cache anything which we don't need.

Indeed, and I actually see no reason why
udev_device_get_sysattr_value() would cause the building of the cache;
shouldn't that be done in the new udev_device_get_sysattr_list_entry()
instead, where it actually belongs?

(Note that you have the wrong function name in the doc comment of
udev_device_get_sysattr_list_entry()).

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux