linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BK PATCH] USB Fixes for 2.6.0-test11
@ 2003-12-11  1:27 Greg KH
  2003-12-11  1:29 ` [PATCH] " Greg KH
  2003-12-11 17:56 ` [BK PATCH] Kobject Fix " Greg KH
  0 siblings, 2 replies; 13+ messages in thread
From: Greg KH @ 2003-12-11  1:27 UTC (permalink / raw)
  To: torvalds; +Cc: linux-usb-devel, linux-kernel

Hi,

Here are some USB fixes for 2.6.0-test11.  They all fix real bugs, and
are 1-4 line fixes with the exception of the usb-serial close() fix,
which is a bit larger, but has been well tested by a number of different
users.

Please pull from:  bk://linuxusb.bkbits.net/gregkh-2.6

Patches will be posted as a follow-up thread for those who want to see
them.

thanks,

greg k-h

 drivers/usb/core/devio.c        |    2 -
 drivers/usb/core/hub.c          |   10 +++++---
 drivers/usb/core/usb.c          |    1 
 drivers/usb/image/Kconfig       |    4 ++-
 drivers/usb/misc/auerswald.c    |    4 +--
 drivers/usb/serial/usb-serial.c |   50 +++++++++++-----------------------------
 drivers/usb/storage/datafab.c   |    2 -
 drivers/usb/storage/jumpshot.c  |    2 -
 scripts/file2alias.c            |    7 +++++
 9 files changed, 37 insertions(+), 45 deletions(-)
-----

Alan Stern:
  o USB: fix bug not setting device state following usb_device_reset()

Andrey Borzenkov:
  o USB: prevent catch-all USB aliases in modules.alias

David Brownell:
  o USB: fix remove device after set_configuration

Greg Kroah-Hartman:
  o USB: fix bug for multiple opens on ttyUSB devices
  o USB: fix race with hub devices disconnecting while stuff is still happening to them
  o USB: register usb-serial ports in the proper place in sysfs

Herbert Xu:
  o USB: Fix connect/disconnect race

Matthew Dharm:
  o USB storage: fix for jumpshot and datafab devices

Oliver Neukum:
  o USB: fix race with signal delivery in usbfs
  o USB: fix sleping in interrupt bug in auerswald driver

Tom Rini:
  o USB: mark the scanner driver as obsolete


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] USB Fixes for 2.6.0-test11
  2003-12-11  1:29   ` Greg KH
@ 2003-12-11  1:29     ` Greg KH
  2003-12-11  1:29       ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2003-12-11  1:29 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

ChangeSet 1.1518, 2003/12/08 13:58:14-08:00, greg@kroah.com

[PATCH] USB: fix race with hub devices disconnecting while stuff is still happening to them.


 drivers/usb/core/hub.c |    3 +++
 1 files changed, 3 insertions(+)


diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c	Wed Dec 10 16:47:50 2003
+++ b/drivers/usb/core/hub.c	Wed Dec 10 16:47:50 2003
@@ -692,6 +692,9 @@
 	struct usb_hub *hub = usb_get_intfdata(dev->actconfig->interface[0]);
 	int ret;
 
+	if (!hub)
+		return -ENODEV;
+
 	ret = get_port_status(dev, port + 1, &hub->status->port);
 	if (ret < 0)
 		dev_err (hubdev (dev),


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] USB Fixes for 2.6.0-test11
  2003-12-11  1:27 [BK PATCH] USB Fixes for 2.6.0-test11 Greg KH
@ 2003-12-11  1:29 ` Greg KH
  2003-12-11  1:29   ` Greg KH
  2003-12-11 17:56 ` [BK PATCH] Kobject Fix " Greg KH
  1 sibling, 1 reply; 13+ messages in thread
From: Greg KH @ 2003-12-11  1:29 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

ChangeSet 1.1516, 2003/12/08 11:10:51-08:00, greg@kroah.com

[PATCH] USB: register usb-serial ports in the proper place in sysfs

They should be bound to the interface the driver is attached to, not
the device.


 drivers/usb/serial/usb-serial.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Nru a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
--- a/drivers/usb/serial/usb-serial.c	Wed Dec 10 16:48:06 2003
+++ b/drivers/usb/serial/usb-serial.c	Wed Dec 10 16:48:06 2003
@@ -1242,7 +1242,7 @@
 	/* register all of the individual ports with the driver core */
 	for (i = 0; i < num_ports; ++i) {
 		port = serial->port[i];
-		port->dev.parent = &serial->dev->dev;
+		port->dev.parent = &interface->dev;
 		port->dev.driver = NULL;
 		port->dev.bus = &usb_serial_bus_type;
 		port->dev.release = &port_release;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] USB Fixes for 2.6.0-test11
  2003-12-11  1:29 ` [PATCH] " Greg KH
@ 2003-12-11  1:29   ` Greg KH
  2003-12-11  1:29     ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2003-12-11  1:29 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

ChangeSet 1.1517, 2003/12/08 13:28:46-08:00, david-b@pacbell.net

[PATCH] USB: fix remove device after set_configuration

If a device can't be configured, the current test9 code forgets
to clean it out of sysfs.  This resolves that issue, so the retry
in usb_new_device() stands a chance of working.

The enumeration code still doesn't handle such errors well, but
at least this way that hub port can be used for another device.


 drivers/usb/core/usb.c |    1 +
 1 files changed, 1 insertion(+)


diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c	Wed Dec 10 16:47:58 2003
+++ b/drivers/usb/core/usb.c	Wed Dec 10 16:47:58 2003
@@ -1120,6 +1120,7 @@
 	if (err) {
 		dev_err(&dev->dev, "can't set config #%d, error %d\n",
 			dev->config[0].desc.bConfigurationValue, err);
+		device_del(&dev->dev);
 		goto fail;
 	}
 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] USB Fixes for 2.6.0-test11
  2003-12-11  1:29     ` Greg KH
@ 2003-12-11  1:29       ` Greg KH
  2003-12-11  1:29         ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2003-12-11  1:29 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

ChangeSet 1.1519, 2003/12/09 09:35:37-08:00, mdharm-usb@one-eyed-alien.net

[PATCH] USB storage: fix for jumpshot and datafab devices

This patch fixes some obvious errors in the jumpshot and datafab drivers.

This should close out Bugzilla bug #1408

> Date: Mon, 1 Dec 2003 12:14:53 -0500 (EST)
> From: Alan Stern <stern@rowland.harvard.edu>
> Subject: Patch from Eduard Hasenleithner
> To: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
> cc: USB Storage List <usb-storage@one-eyed-alien.net>
>
> Matt:
>
> Did you see this patch?  It was posted to the usb-development mailing list
> about a week ago, before I started making all my changes.  It is clearly
> correct and necessary.
>
> Alan Stern


 drivers/usb/storage/datafab.c  |    2 +-
 drivers/usb/storage/jumpshot.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


diff -Nru a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
--- a/drivers/usb/storage/datafab.c	Wed Dec 10 16:47:42 2003
+++ b/drivers/usb/storage/datafab.c	Wed Dec 10 16:47:42 2003
@@ -387,7 +387,7 @@
 
 	// we'll go ahead and extract the media capacity while we're here...
 	//
-	rc = datafab_bulk_read(us, reply, sizeof(reply));
+	rc = datafab_bulk_read(us, reply, 512);
 	if (rc == USB_STOR_XFER_GOOD) {
 		// capacity is at word offset 57-58
 		//
diff -Nru a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
--- a/drivers/usb/storage/jumpshot.c	Wed Dec 10 16:47:42 2003
+++ b/drivers/usb/storage/jumpshot.c	Wed Dec 10 16:47:42 2003
@@ -317,7 +317,7 @@
 	}
 
 	// read the reply
-	rc = jumpshot_bulk_read(us, reply, sizeof(reply));
+	rc = jumpshot_bulk_read(us, reply, 512);
 	if (rc != USB_STOR_XFER_GOOD) {
 		rc = USB_STOR_TRANSPORT_ERROR;
 		goto leave;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] USB Fixes for 2.6.0-test11
  2003-12-11  1:29         ` Greg KH
@ 2003-12-11  1:29           ` Greg KH
  2003-12-11  1:29             ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2003-12-11  1:29 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

ChangeSet 1.1521, 2003/12/09 10:00:49-08:00, oliver@neukum.org

[PATCH] USB: fix sleping in interrupt bug in auerswald driver

this fixes two instances of GFP_KERNEL from completion handlers.


 drivers/usb/misc/auerswald.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff -Nru a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
--- a/drivers/usb/misc/auerswald.c	Wed Dec 10 16:47:26 2003
+++ b/drivers/usb/misc/auerswald.c	Wed Dec 10 16:47:26 2003
@@ -324,7 +324,7 @@
                 urb    = acep->urbp;
                 dbg ("auerchain_complete: submitting next urb from chain");
 		urb->status = 0;	/* needed! */
-		result = usb_submit_urb(urb, GFP_KERNEL);
+		result = usb_submit_urb(urb, GFP_ATOMIC);
 
                 /* check for submit errors */
                 if (result) {
@@ -402,7 +402,7 @@
         if (acep) {
                 dbg("submitting urb immediate");
 		urb->status = 0;	/* needed! */
-                result = usb_submit_urb(urb, GFP_KERNEL);
+                result = usb_submit_urb(urb, GFP_ATOMIC);
                 /* check for submit errors */
                 if (result) {
                         urb->status = result;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] USB Fixes for 2.6.0-test11
  2003-12-11  1:29       ` Greg KH
@ 2003-12-11  1:29         ` Greg KH
  2003-12-11  1:29           ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2003-12-11  1:29 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

ChangeSet 1.1520, 2003/12/09 09:42:34-08:00, trini@kernel.crashing.org

[PATCH] USB: mark the scanner driver as obsolete

On Mon, Dec 01, 2003 at 11:21:58AM -0800, Greg KH wrote:
> Can't you use xsane without the scanner kernel driver?  I thought the
> latest versions used libusb/usbfs to talk directly to the hardware.
> Because of this, the USB scanner driver is marked to be removed from the
> kernel sometime in the near future.

After a bit of mucking around (and possibly finding a bug with debian's
libusb/xsane/hotplug interaction, nothing seems to run
/etc/hotplug/usb/libusbscanner and thus only root can scan, anyone whose
got this working please let me know), the problem does not exist if I
only use  libusb xsane.

How about the following:


 drivers/usb/image/Kconfig |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


diff -Nru a/drivers/usb/image/Kconfig b/drivers/usb/image/Kconfig
--- a/drivers/usb/image/Kconfig	Wed Dec 10 16:47:34 2003
+++ b/drivers/usb/image/Kconfig	Wed Dec 10 16:47:34 2003
@@ -18,12 +18,14 @@
 	  module will be called mdc800.
 
 config USB_SCANNER
-	tristate "USB Scanner support"
+	tristate "USB Scanner support (OBSOLETE)"
 	depends on USB
 	help
 	  Say Y here if you want to connect a USB scanner to your computer's
 	  USB port. Please read <file:Documentation/usb/scanner.txt> for more
 	  information.
+
+	  This driver has been obsoleted by support via libusb.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called scanner.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] USB Fixes for 2.6.0-test11
  2003-12-11  1:29               ` Greg KH
@ 2003-12-11  1:29                 ` Greg KH
  2003-12-11  1:29                   ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2003-12-11  1:29 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

ChangeSet 1.1524, 2003/12/09 17:40:44-08:00, herbert@gondor.apana.org.au

[PATCH] USB: Fix connect/disconnect race

This patch was integrated by you in 2.4 six months ago.  Unfortunately
it never got into 2.5.  Without it you can end up with crashes such
as http://bugs.debian.org/218670


 drivers/usb/core/hub.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c	Wed Dec 10 16:47:01 2003
+++ b/drivers/usb/core/hub.c	Wed Dec 10 16:47:01 2003
@@ -929,7 +929,6 @@
 			break;
 		}
 
-		hub->children[port] = dev;
 		dev->state = USB_STATE_POWERED;
 
 		/* Reset the device, and detect its speed */
@@ -982,8 +981,10 @@
 		dev->dev.parent = dev->parent->dev.parent->parent;
 
 		/* Run it through the hoops (find a driver, etc) */
-		if (!usb_new_device(dev, &hub->dev))
+		if (!usb_new_device(dev, &hub->dev)) {
+			hub->children[port] = dev;
 			goto done;
+		}
 
 		/* Free the configuration if there was an error */
 		usb_put_dev(dev);
@@ -992,7 +993,6 @@
 		delay = HUB_LONG_RESET_TIME;
 	}
 
-	hub->children[port] = NULL;
 	hub_port_disable(hub, port);
 done:
 	up(&usb_address0_sem);


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] USB Fixes for 2.6.0-test11
  2003-12-11  1:29           ` Greg KH
@ 2003-12-11  1:29             ` Greg KH
  2003-12-11  1:29               ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2003-12-11  1:29 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

ChangeSet 1.1522, 2003/12/09 10:18:07-08:00, oliver@neukum.org

[PATCH] USB: fix race with signal delivery in usbfs

apart from locking bugs, there are other races. This fixes one with
signal delivery. The signal should be delivered _before_ the reciever
is woken.


 drivers/usb/core/devio.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Nru a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
--- a/drivers/usb/core/devio.c	Wed Dec 10 16:47:18 2003
+++ b/drivers/usb/core/devio.c	Wed Dec 10 16:47:18 2003
@@ -261,7 +261,6 @@
         spin_lock(&ps->lock);
         list_move_tail(&as->asynclist, &ps->async_completed);
         spin_unlock(&ps->lock);
-        wake_up(&ps->wait);
 	if (as->signr) {
 		sinfo.si_signo = as->signr;
 		sinfo.si_errno = as->urb->status;
@@ -269,6 +268,7 @@
 		sinfo.si_addr = (void *)as->userurb;
 		send_sig_info(as->signr, &sinfo, as->task);
 	}
+        wake_up(&ps->wait);
 }
 
 static void destroy_async (struct dev_state *ps, struct list_head *list)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] USB Fixes for 2.6.0-test11
  2003-12-11  1:29             ` Greg KH
@ 2003-12-11  1:29               ` Greg KH
  2003-12-11  1:29                 ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2003-12-11  1:29 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

ChangeSet 1.1523, 2003/12/09 15:41:57-08:00, stern@rowland.harvard.edu

[PATCH] USB: fix bug not setting device state following usb_device_reset()


 drivers/usb/core/hub.c |    1 +
 1 files changed, 1 insertion(+)


diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c	Wed Dec 10 16:47:09 2003
+++ b/drivers/usb/core/hub.c	Wed Dec 10 16:47:09 2003
@@ -1345,6 +1345,7 @@
 			dev->devpath, ret);
 		return ret;
 	}
+	dev->state = USB_STATE_CONFIGURED;
 
 	for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
 		struct usb_interface *intf = dev->actconfig->interface[i];


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] USB Fixes for 2.6.0-test11
  2003-12-11  1:29                 ` Greg KH
@ 2003-12-11  1:29                   ` Greg KH
  2003-12-11  1:29                     ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2003-12-11  1:29 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

ChangeSet 1.1525, 2003/12/10 14:39:48-08:00, greg@kroah.com

[PATCH] USB: fix bug for multiple opens on ttyUSB devices.

This patch fixes the bug where running ppp over a ttyUSB device would fail.


 drivers/usb/serial/usb-serial.c |   48 ++++++++++------------------------------
 1 files changed, 13 insertions(+), 35 deletions(-)


diff -Nru a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
--- a/drivers/usb/serial/usb-serial.c	Wed Dec 10 16:46:53 2003
+++ b/drivers/usb/serial/usb-serial.c	Wed Dec 10 16:46:53 2003
@@ -493,12 +493,15 @@
 	return retval;
 }
 
-static void __serial_close(struct usb_serial_port *port, struct file *filp)
+static void serial_close(struct tty_struct *tty, struct file * filp)
 {
-	if (!port->open_count) {
-		dbg ("%s - port not opened", __FUNCTION__);
+	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
+	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
+
+	if (!serial)
 		return;
-	}
+
+	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	--port->open_count;
 	if (port->open_count <= 0) {
@@ -506,30 +509,18 @@
 		 * port is being closed by the last owner */
 		port->serial->type->close(port, filp);
 		port->open_count = 0;
+
+		if (port->tty) {
+			if (port->tty->driver_data)
+				port->tty->driver_data = NULL;
+			port->tty = NULL;
+		}
 	}
 
 	module_put(port->serial->type->owner);
 	kobject_put(&port->serial->kobj);
 }
 
-static void serial_close(struct tty_struct *tty, struct file * filp)
-{
-	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-
-	if (!serial)
-		return;
-
-	dbg("%s - port %d", __FUNCTION__, port->number);
-
-	/* if disconnect beat us to the punch here, there's nothing to do */
-	if (tty && tty->driver_data) {
-		__serial_close(port, filp);
-		tty->driver_data = NULL;
-	}
-	port->tty = NULL;
-}
-
 static int serial_write (struct tty_struct * tty, int from_user, const unsigned char *buf, int count)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
@@ -848,19 +839,6 @@
 	dbg ("%s - %s", __FUNCTION__, kobj->name);
 
 	serial = to_usb_serial(kobj);
-
-	/* fail all future close/read/write/ioctl/etc calls */
-	for (i = 0; i < serial->num_ports; ++i) {
-		port = serial->port[i];
-		if (port->tty != NULL) {
-			port->tty->driver_data = NULL;
-			while (port->open_count > 0) {
-				__serial_close(port, NULL);
-			}
-			port->tty = NULL;
-		}
-	}
-
 	serial_shutdown (serial);
 
 	/* return the minor range that this device had */


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] USB Fixes for 2.6.0-test11
  2003-12-11  1:29                   ` Greg KH
@ 2003-12-11  1:29                     ` Greg KH
  0 siblings, 0 replies; 13+ messages in thread
From: Greg KH @ 2003-12-11  1:29 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

ChangeSet 1.1526, 2003/12/10 16:00:53-08:00, arvidjaar@mail.ru

[PATCH] USB: prevent catch-all USB aliases in modules.alias

visor.c defines one empty slot in USB ids table that can be filled in at
runtime using module parameters. file2alias generates catch-all alias for it:

alias usb:v*p*dl*dh*dc*dsc*dp*ic*isc*ip* visor

patch adds the same sanity check as in depmod to scripts/file2alias.


 scripts/file2alias.c |    7 +++++++
 1 files changed, 7 insertions(+)


diff -Nru a/scripts/file2alias.c b/scripts/file2alias.c
--- a/scripts/file2alias.c	Wed Dec 10 16:46:45 2003
+++ b/scripts/file2alias.c	Wed Dec 10 16:46:45 2003
@@ -52,6 +52,13 @@
 	id->bcdDevice_lo = TO_NATIVE(id->bcdDevice_lo);
 	id->bcdDevice_hi = TO_NATIVE(id->bcdDevice_hi);
 
+	/*
+	 * Some modules (visor) have empty slots as placeholder for
+	 * run-time specification that results in catch-all alias
+	 */
+	if (!(id->idVendor | id->bDeviceClass | id->bInterfaceClass))
+		return 1;
+
 	strcpy(alias, "usb:");
 	ADD(alias, "v", id->match_flags&USB_DEVICE_ID_MATCH_VENDOR,
 	    id->idVendor);


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [BK PATCH] Kobject Fix for 2.6.0-test11
  2003-12-11  1:27 [BK PATCH] USB Fixes for 2.6.0-test11 Greg KH
  2003-12-11  1:29 ` [PATCH] " Greg KH
@ 2003-12-11 17:56 ` Greg KH
  1 sibling, 0 replies; 13+ messages in thread
From: Greg KH @ 2003-12-11 17:56 UTC (permalink / raw)
  To: torvalds; +Cc: linux-usb-devel, linux-kernel

On Wed, Dec 10, 2003 at 05:27:31PM -0800, Greg KH wrote:
> 
> Here are some USB fixes for 2.6.0-test11.  They all fix real bugs, and
> are 1-4 line fixes with the exception of the usb-serial close() fix,
> which is a bit larger, but has been well tested by a number of different
> users.
> 
> Please pull from:  bk://linuxusb.bkbits.net/gregkh-2.6

I've added the following patch to this repository.  If you've already
pulled from here, feel free to just apply this single patch.  Or you can
pull from that tree again, which ever is easier for you.

It fixes a kobject bug where the parent could be deleted before the
child object, causing all sorts of badness later when we clean up the
child object.  It's been acked by Pat.

thanks,

greg k-h

 Subject: kobject: fix bug where a parent could be deleted before a child device.

diff -Nru a/lib/kobject.c b/lib/kobject.c
--- a/lib/kobject.c	Thu Dec 11 09:54:23 2003
+++ b/lib/kobject.c	Thu Dec 11 09:54:23 2003
@@ -236,8 +236,6 @@
 		list_del_init(&kobj->entry);
 		up_write(&kobj->kset->subsys->rwsem);
 	}
-	if (kobj->parent) 
-		kobject_put(kobj->parent);
 	kobject_put(kobj);
 }
 
@@ -274,9 +272,11 @@
 	kobj->parent = parent;
 
 	error = create_dir(kobj);
-	if (error)
+	if (error) {
 		unlink(kobj);
-	else {
+		if (parent)
+			kobject_put(parent);
+	} else {
 		/* If this kobj does not belong to a kset,
 		   try to find a parent that does. */
 		top_kobj = kobj;
@@ -452,6 +452,7 @@
 {
 	struct kobj_type * t = get_ktype(kobj);
 	struct kset * s = kobj->kset;
+	struct kobject * parent = kobj->parent;
 
 	pr_debug("kobject %s: cleaning up\n",kobject_name(kobj));
 	if (kobj->k_name != kobj->name)
@@ -461,6 +462,8 @@
 		t->release(kobj);
 	if (s)
 		kset_put(s);
+	if (parent) 
+		kobject_put(parent);
 }
 
 /**

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-12-11 17:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-11  1:27 [BK PATCH] USB Fixes for 2.6.0-test11 Greg KH
2003-12-11  1:29 ` [PATCH] " Greg KH
2003-12-11  1:29   ` Greg KH
2003-12-11  1:29     ` Greg KH
2003-12-11  1:29       ` Greg KH
2003-12-11  1:29         ` Greg KH
2003-12-11  1:29           ` Greg KH
2003-12-11  1:29             ` Greg KH
2003-12-11  1:29               ` Greg KH
2003-12-11  1:29                 ` Greg KH
2003-12-11  1:29                   ` Greg KH
2003-12-11  1:29                     ` Greg KH
2003-12-11 17:56 ` [BK PATCH] Kobject Fix " Greg KH

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).