diff options
author | Bart Westgeest <bart@elbrys.com> | 2012-01-25 13:46:32 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-08 17:14:15 -0500 |
commit | 737912e11bf5bd4874acc771d8511a6eab891fc5 (patch) | |
tree | d5af155fa17a25e2ce253e32c47c13408e739fe0 | |
parent | 4c0029f01f4009d6ab149230026c9716bde96283 (diff) |
staging: usbip: fix to prevent potentially using uninitialized spinlock
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>
-rw-r--r-- | drivers/staging/usbip/stub_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/usbip/stub_main.c b/drivers/staging/usbip/stub_main.c index 2d6317850064..705a9e530a19 100644 --- a/drivers/staging/usbip/stub_main.c +++ b/drivers/staging/usbip/stub_main.c | |||
@@ -246,8 +246,9 @@ static int __init usbip_host_init(void) | |||
246 | { | 246 | { |
247 | int ret; | 247 | int ret; |
248 | 248 | ||
249 | stub_priv_cache = KMEM_CACHE(stub_priv, SLAB_HWCACHE_ALIGN); | 249 | init_busid_table(); |
250 | 250 | ||
251 | stub_priv_cache = KMEM_CACHE(stub_priv, SLAB_HWCACHE_ALIGN); | ||
251 | if (!stub_priv_cache) { | 252 | if (!stub_priv_cache) { |
252 | pr_err("kmem_cache_create failed\n"); | 253 | pr_err("kmem_cache_create failed\n"); |
253 | return -ENOMEM; | 254 | return -ENOMEM; |
@@ -266,7 +267,6 @@ static int __init usbip_host_init(void) | |||
266 | goto err_create_file; | 267 | goto err_create_file; |
267 | } | 268 | } |
268 | 269 | ||
269 | init_busid_table(); | ||
270 | pr_info(DRIVER_DESC " v" USBIP_VERSION "\n"); | 270 | pr_info(DRIVER_DESC " v" USBIP_VERSION "\n"); |
271 | return ret; | 271 | return ret; |
272 | 272 | ||