Skip to content

Commit

Permalink
scsi_debug: take sdebug_host_list_lock when changing capacity
Browse files Browse the repository at this point in the history
All other traversals of the sdebug_host_list take the lock.

Signed-off-by: Ewan D. Milne <emilne@redhat.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Ewan D. Milne authored and Christoph Hellwig committed Dec 15, 2014
1 parent 6d6f380 commit 4bc6b63
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/scsi/scsi_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -4438,6 +4438,7 @@ static ssize_t virtual_gb_store(struct device_driver *ddp, const char *buf,
struct sdebug_host_info *sdhp;
struct sdebug_dev_info *dp;

spin_lock(&sdebug_host_list_lock);
list_for_each_entry(sdhp, &sdebug_host_list,
host_list) {
list_for_each_entry(dp, &sdhp->dev_info_list,
Expand All @@ -4446,6 +4447,7 @@ static ssize_t virtual_gb_store(struct device_driver *ddp, const char *buf,
dp->uas_bm);
}
}
spin_unlock(&sdebug_host_list_lock);
}
return count;
}
Expand Down

0 comments on commit 4bc6b63

Please sign in to comment.