From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Pitt Date: Thu, 03 Mar 2011 17:00:07 +0000 Subject: Re: [PATCH 0/2] libudev: Get all sysfs attrs for a device Message-Id: <20110303170006.GF4723@piware.de> List-Id: References: <4D6F5CA6.2010905@secunet.com> In-Reply-To: <4D6F5CA6.2010905@secunet.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org 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)