Skip to content

Commit

Permalink
staging: usbip: fix to prevent potentially using uninitialized spinlock
Browse files Browse the repository at this point in the history
The stub_probe function can be called as soon as the stub_driver is
registered. This can lead to the busid_table_lock being used before it
is initialized. Moved calling the init_busid_table function (which
initalizes this spinlock) to be called earlier in the init function to
prevent this from happening.

Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Bart Westgeest authored and Greg Kroah-Hartman committed Feb 8, 2012
1 parent 4c0029f commit 737912e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/usbip/stub_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,9 @@ static int __init usbip_host_init(void)
{
int ret;

stub_priv_cache = KMEM_CACHE(stub_priv, SLAB_HWCACHE_ALIGN);
init_busid_table();

stub_priv_cache = KMEM_CACHE(stub_priv, SLAB_HWCACHE_ALIGN);
if (!stub_priv_cache) {
pr_err("kmem_cache_create failed\n");
return -ENOMEM;
Expand All @@ -266,7 +267,6 @@ static int __init usbip_host_init(void)
goto err_create_file;
}

init_busid_table();
pr_info(DRIVER_DESC " v" USBIP_VERSION "\n");
return ret;

Expand Down

0 comments on commit 737912e

Please sign in to comment.