linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: [udev] bug in udev-remove.c
Date: Wed, 17 Dec 2003 21:53:44 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-107169815509004@msgid-missing> (raw)

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]


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



[-- Attachment #2: 01-bug-in-remove.diff --]
[-- Type: text/plain, Size: 731 bytes --]

--- ../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);
 }

             reply	other threads:[~2003-12-17 21:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-17 21:53 Kay Sievers [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-12-17 22:37 [udev] bug in udev-remove.c Greg KH
2003-12-18  2:27 ` Kay Sievers
2003-12-19 18:30 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-hotplug-107169815509004@msgid-missing \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).