hso driver
Subsystems (4)
Hi,
this fixes a locking bug Paulius reported.
Regards
Oliver
Signed-off-by Oliver Neukum <[email protected]>
---
drivers/net/usb/hso.c renamed from drivers/net/usb/hso.c.alt3 +11 -11
@@ -156,7 +156,7 @@ struct hso_shared_int {struct usb_device *usb;int use_count;int ref_count; -spinlock_t shared_int_lock; +struct mutex shared_int_lock; };struct hso_net {
@@ -2040,14 +2040,14 @@ static int hso_start_serial_device(struc } } }else { -spin_lock_bh (&serial->shared_int->shared_int_lock); +mutex_lock (&serial->shared_int->shared_int_lock);if (!serial->shared_int->use_count) { result =hso_mux_submit_intr_urb (serial->shared_int, - hso_dev->usb,GFP_ATOMIC ); + hso_dev->usb, flags); } serial->shared_int->use_count++; -spin_unlock_bh (&serial->shared_int->shared_int_lock); +mutex_unlock (&serial->shared_int->shared_int_lock); }return result;
@@ -2070,7 +2070,7 @@ static int hso_stop_serial_device(structusb_kill_urb (serial->rx_urb[i]);if (serial->shared_int) { -spin_lock_bh (&serial->shared_int->shared_int_lock); +mutex_lock (&serial->shared_int->shared_int_lock);if (serial->shared_int->use_count && (--serial->shared_int->use_count ==0 )) {struct urb *urb;
@@ -2079,7 +2079,7 @@ static int hso_stop_serial_device(structif (urb)usb_kill_urb (urb); } -spin_unlock_bh (&serial->shared_int->shared_int_lock); +mutex_unlock (&serial->shared_int->shared_int_lock); }return 0 ;
@@ -2352,10 +2352,10 @@ static void hso_free_serial_device(struchso_serial_common_free (serial);if (serial->shared_int) { -spin_lock_bh (&serial->shared_int->shared_int_lock); +mutex_lock (&serial->shared_int->shared_int_lock);if (--serial->shared_int->ref_count ==0 )hso_free_shared_int (serial->shared_int); -spin_unlock_bh (&serial->shared_int->shared_int_lock); +mutex_unlock (&serial->shared_int->shared_int_lock); }kfree (serial);hso_free_device (hso_dev);
@@ -2468,9 +2468,9 @@ struct hso_device *hso_create_mux_serial serial->write_data = hso_mux_serial_write_data; serial->shared_int = mux; -spin_lock_bh (&serial->shared_int->shared_int_lock); +mutex_lock (&serial->shared_int->shared_int_lock); serial->shared_int->ref_count++; -spin_unlock_bh (&serial->shared_int->shared_int_lock); +mutex_unlock (&serial->shared_int->shared_int_lock);/* and record this serial */ set_serial_by_index (serial->minor, serial);
@@ -2535,7 +2535,7 @@ struct hso_shared_int *hso_create_shared goto exit; } -spin_lock_init (&mux->shared_int_lock); +mutex_init (&mux->shared_int_lock);return mux;