diff options
author | Duncan Sands <baldrick@free.fr> | 2006-10-05 09:56:44 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-10-17 14:46:31 -0700 |
commit | ccf40d62c70128990cf2e8775853cc3287cd7ce3 (patch) | |
tree | 1f9ee5f3da100404be153f6d2a563b682d3f2ecc /drivers/usb | |
parent | e4a20daa7b44ab9805979eb716f6bb7532bc67b9 (diff) | |
download | op-kernel-dev-ccf40d62c70128990cf2e8775853cc3287cd7ce3.zip op-kernel-dev-ccf40d62c70128990cf2e8775853cc3287cd7ce3.tar.gz |
usbatm: fix tiny race
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/atm/usbatm.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index 309073f..ab091fa 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c @@ -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; |