If usbatm_do_heavy_init finishes before usbatm_heavy_init
writes the pid, the disconnect method could shoot down the
wrong process if the pid has been recycled.

Signed-off-by: Duncan Sands <[EMAIL PROTECTED]>

diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index a38701c..d7085e8 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -1001,6 +1001,7 @@ static int usbatm_do_heavy_init(void *ar
 
        daemonize(instance->driver->driver_name);
        allow_signal(SIGTERM);
+       instance->thread_pid = get_current()->pid;
 
        complete(&instance->thread_started);
 
@@ -1025,10 +1026,6 @@ static int usbatm_heavy_init(struct usba
                return ret;
        }
 
-       mutex_lock(&instance->serialize);
-       instance->thread_pid = ret;
-       mutex_unlock(&instance->serialize);
-
        wait_for_completion(&instance->thread_started);
 
        return 0;

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to