From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Sat, 03 Jan 2004 23:07:21 +0000 Subject: Re: udev - Shouldn't we blacklist some devices? Message-Id: <20040103230721.GA5235@vrfy.org> MIME-Version: 1 Content-Type: multipart/mixed; boundary="rwEMma7ioTxnRzrJ" List-Id: References: <20040103200753.GA4917@vrfy.org> In-Reply-To: <20040103200753.GA4917@vrfy.org> To: linux-hotplug@vger.kernel.org --rwEMma7ioTxnRzrJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Jan 03, 2004 at 01:48:57PM -0800, Greg KH wrote: > On Sat, Jan 03, 2004 at 09:07:53PM +0100, Kay Sievers wrote: > > While connecting my flash reader to the USB bus I get: > > > > Jan 3 20:56:58 pim udev[31673]: sleep_for_dev: looking for '/sys/class/scsi_device/54:0:0:2/dev' > > Jan 3 20:56:59 pim udev[31695]: sleep_for_dev: looking for '/sys/class/scsi_device/54:0:0:3/dev' > > Jan 3 20:56:59 pim udev[31514]: sleep_for_dev: looking for '/sys/class/scsi_host/host54/dev' > > > > Shouldn't we blacklist devices like /sys/class/scsi_device/*, /sys/class/scsi_host/* ? > > Yes we should, as we try to remove those device nodes when the devices > get removed (look for the 'trying to remove host54' messages), which > could be very dangerous. > So, here we go: Blacklist devices that we don't want to process, like: /sys/class/scsi_device/*, /sys/class/scsi_host/*, cause these devices are handled by the block device events we receive and we don't try to remove non existing nodes. thanks, Kay --rwEMma7ioTxnRzrJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="01-blacklist-for-devices.diff" diff -Nru a/udev.c b/udev.c --- a/udev.c Sat Jan 3 23:58:38 2004 +++ b/udev.c Sat Jan 3 23:58:38 2004 @@ -139,12 +139,19 @@ return retval; } +static char *dev_path_blacklist[] = { + "class/scsi_host", + "class/scsi_device", + "" +}; + static inline int udev_hotplug(int argc, char **argv) { char *action; char *devpath; char *subsystem; int retval = -EINVAL; + int i; subsystem = argv[1]; @@ -160,6 +167,16 @@ !strstr(devpath, "block")) { dbg("not a block or class device"); goto exit; + } + + /* skip blacklisted path */ + i = 0; + while (dev_path_blacklist[i][0] != '\0') { + if (strstr(devpath, dev_path_blacklist[i])) { + dbg("device with path '%s' is blacklisted", devpath); + goto exit; + } + i++; } /* but we don't care about net class devices */ --rwEMma7ioTxnRzrJ-- ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel