lkml.org 
[lkml]   [2010]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 07/29] memstick: mspro: two fixes
Date
fix uninitialized spinlock warning on resume
and race in idr_pre_get

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/memstick/core/mspro_block.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index a979c9d..13cb83b 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -485,6 +485,7 @@ has_int_reg:
t_offset = msb->req_sg[msb->current_seg].offset;
t_offset += msb->current_page * msb->page_size;

+ sg_init_table(&t_sg, 1);
sg_set_page(&t_sg,
nth_page(sg_page(&(msb->req_sg[msb->current_seg])),
t_offset >> PAGE_SHIFT),
@@ -1056,10 +1057,13 @@ static int mspro_block_init_disk(struct memstick_dev *card)

msb->page_size = be16_to_cpu(sys_info->unit_size);

- if (!idr_pre_get(&mspro_block_disk_idr, GFP_KERNEL))
+ mutex_lock(&mspro_block_disk_lock);
+
+ if (!idr_pre_get(&mspro_block_disk_idr, GFP_KERNEL)) {
+ mutex_unlock(&mspro_block_disk_lock);
return -ENOMEM;
+ }

- mutex_lock(&mspro_block_disk_lock);
rc = idr_get_new(&mspro_block_disk_idr, card, &disk_id);
mutex_unlock(&mspro_block_disk_lock);

@@ -1248,6 +1252,8 @@ static int mspro_block_resume(struct memstick_dev *card)

new_msb->card = card;
memstick_set_drvdata(card, new_msb);
+ spin_lock_init(&new_msb->q_lock);
+
if (mspro_block_init_card(card))
goto out_free;

--
1.7.1


\
 
 \ /
  Last update: 2010-10-23 01:57    [W:3.590 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site