[PATCH] fix usb_serial_put synchronization

From: Benny Halevy
Date: Tue May 15 2007 - 03:41:31 EST



Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxxxxxxx>
---
drivers/usb/serial/usb-serial.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 87f3788..4e5b996 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -120,11 +120,9 @@ static void return_serial(struct usb_serial *serial)
if (serial == NULL)
return;

- spin_lock(&table_lock);
for (i = 0; i < serial->num_ports; ++i) {
serial_table[serial->minor + i] = NULL;
}
- spin_unlock(&table_lock);
}

static void destroy_serial(struct kref *kref)
@@ -172,7 +170,9 @@ static void destroy_serial(struct kref *kref)

void usb_serial_put(struct usb_serial *serial)
{
+ spin_lock(&table_lock);
kref_put(&serial->kref, destroy_serial);
+ spin_unlock(&table_lock);
}

/*****************************************************************************

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/