]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
usbatm: fix tiny race
authorDuncan Sands <baldrick@free.fr>
Thu, 5 Oct 2006 07:56:44 +0000 (09:56 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Oct 2006 21:46:31 +0000 (14:46 -0700)
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 <baldrick@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/atm/usbatm.c

index 309073f6433a73d02b8355e4605e0ab8187a3a87..ab091fa4c86b475de4d50f9851ebe83f7d5ce2cb 100644 (file)
@@ -1001,6 +1001,7 @@ static int usbatm_do_heavy_init(void *arg)
 
        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 usbatm_data *instance)
                return ret;
        }
 
-       mutex_lock(&instance->serialize);
-       instance->thread_pid = ret;
-       mutex_unlock(&instance->serialize);
-
        wait_for_completion(&instance->thread_started);
 
        return 0;