From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Wed, 17 Dec 2003 21:53:44 +0000 Subject: [udev] bug in udev-remove.c MIME-Version: 1 Content-Type: multipart/mixed; boundary="zx4FCpZtqtKETZ7O" Message-Id: List-Id: To: linux-hotplug@vger.kernel.org --zx4FCpZtqtKETZ7O Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Uups, we have a bug in udev-remove.c. udev segfaults with NULL-pointer, if the device is not in the database: ./test.block: line 29: 4844 Segmentation fault $BIN block Dec 17 22:47:42 pim udev[4882]: udev_remove_device: '/block/sdy' not found in database, falling back on default name Dec 17 22:47:42 pim udev[4882]: udev_remove_device: name is '(null)' thanks, Kay --zx4FCpZtqtKETZ7O Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="01-bug-in-remove.diff" --- ../udev/udev-remove.c 2003-12-10 03:40:14.000000000 +0100 +++ udev-remove.c 2003-12-17 22:45:09.000000000 +0100 @@ -118,8 +118,8 @@ */ int udev_remove_device(char *path, char *subsystem) { - char name[100]; struct udevice *dev; + struct udevice device; char *temp; dev = udevdb_get_dev(path); @@ -128,13 +128,15 @@ temp = strrchr(path, '/'); if (temp == NULL) return -ENODEV; - strncpy(name, &temp[1], sizeof(name)); + memset(&device, 0, sizeof(device)); + dev = &device; + strncpy(device.name, &temp[1], sizeof(device.name)); } dbg("name is '%s'", dev->name); udevdb_delete_dev(path); - sysbus_send_remove(name, path); + sysbus_send_remove(dev->name, path); return delete_node(dev); } --zx4FCpZtqtKETZ7O-- ------------------------------------------------------- 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