diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-01-07 17:59:05 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-01-11 19:29:18 -0500 |
commit | 166a72878f76e911f2d1ce4b2310d4403e94be11 (patch) | |
tree | b076d9b97024a220437561d1a343e4a8f3630a63 | |
parent | 210ba1d1724f5c4ed87a2ab1a21ca861a915f734 (diff) |
[SCSI] fix scsi_setup_command_freelist failure path race
Looks like that host_cmd_pool_mutex are necessary here.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r-- | drivers/scsi/scsi.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index ebc019380835..54ff611b8677 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -319,17 +319,16 @@ int scsi_setup_command_freelist(struct Scsi_Host *shost) | |||
319 | GFP_KERNEL | shost->cmd_pool->gfp_mask); | 319 | GFP_KERNEL | shost->cmd_pool->gfp_mask); |
320 | if (!cmd) | 320 | if (!cmd) |
321 | goto fail2; | 321 | goto fail2; |
322 | list_add(&cmd->list, &shost->free_list); | 322 | list_add(&cmd->list, &shost->free_list); |
323 | return 0; | 323 | return 0; |
324 | 324 | ||
325 | fail2: | 325 | fail2: |
326 | mutex_lock(&host_cmd_pool_mutex); | ||
326 | if (!--pool->users) | 327 | if (!--pool->users) |
327 | kmem_cache_destroy(pool->slab); | 328 | kmem_cache_destroy(pool->slab); |
328 | return -ENOMEM; | ||
329 | fail: | 329 | fail: |
330 | mutex_unlock(&host_cmd_pool_mutex); | 330 | mutex_unlock(&host_cmd_pool_mutex); |
331 | return -ENOMEM; | 331 | return -ENOMEM; |
332 | |||
333 | } | 332 | } |
334 | 333 | ||
335 | /** | 334 | /** |