Skip to content

Commit

Permalink
bugfix: Prevent hanging on second failure of queue create
Browse files Browse the repository at this point in the history
        ( missing spin_unlock )
  • Loading branch information
hyeongjunkim committed Nov 22, 2016
1 parent 6296f4c commit 14ad41f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions modules/nvmed.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,19 +533,25 @@ static int nvmed_queue_create(NVMED_NS_ENTRY *ns_entry, unsigned int __user *__q
spin_lock(&dev_entry->ctrl_lock);

//check quota
if(!nvmed_get_remain_user_quota(ns_entry, current_uid()))
if(!nvmed_get_remain_user_quota(ns_entry, current_uid())) {
spin_unlock(&dev_entry->ctrl_lock);
return -NVMED_OVERQUOTA;
}

queue_count = dev->queue_count + dev_entry->num_user_queue;
//db_bar_size check
size = (queue_count+1) * 8 * dev->db_stride;
if(size > 4096)
if(size > 4096) {
spin_unlock(&dev_entry->ctrl_lock);
return -NVMED_EXCEEDLIMIT;
}

//set_queue_count
result = set_queue_count(dev_entry, queue_count);
if(result <= queue_count)
if(result <= queue_count) {
spin_unlock(&dev_entry->ctrl_lock);
return -NVMED_EXCEEDLIMIT;
}

//user_queue_entry create
queue = kzalloc(sizeof(*queue), GFP_KERNEL);
Expand Down

0 comments on commit 14ad41f

Please sign in to comment.