aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian King <brking@linux.vnet.ibm.com>2007-06-13 18:12:33 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-06-17 16:53:17 -0400
commit06f923cbf080e22d1ffccbf3fd2cbab0176f6025 (patch)
tree92c673e82114652e02a7ebfc1749e7763eb22f19
parent3d0e91f7ace12499c4b00088e9a6b1361e1bb0ca (diff)
[SCSI] ibmvscsi: Misc. locking fixes
Fix a couple locking bugs discovered during code inspection. ibmvscsi_send_srp_event needs to be called with the host lock held. This patch fixes a couple paths in the code where this wasn't true. Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 0a16972b2599..934bcad39b3b 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -845,6 +845,7 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata)
845{ 845{
846 struct viosrp_adapter_info *req; 846 struct viosrp_adapter_info *req;
847 struct srp_event_struct *evt_struct; 847 struct srp_event_struct *evt_struct;
848 unsigned long flags;
848 dma_addr_t addr; 849 dma_addr_t addr;
849 850
850 evt_struct = get_event_struct(&hostdata->pool); 851 evt_struct = get_event_struct(&hostdata->pool);
@@ -875,6 +876,7 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata)
875 return; 876 return;
876 } 877 }
877 878
879 spin_lock_irqsave(hostdata->host->host_lock, flags);
878 if (ibmvscsi_send_srp_event(evt_struct, hostdata, init_timeout * 2)) { 880 if (ibmvscsi_send_srp_event(evt_struct, hostdata, init_timeout * 2)) {
879 dev_err(hostdata->dev, "couldn't send ADAPTER_INFO_REQ!\n"); 881 dev_err(hostdata->dev, "couldn't send ADAPTER_INFO_REQ!\n");
880 dma_unmap_single(hostdata->dev, 882 dma_unmap_single(hostdata->dev,
@@ -882,6 +884,7 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata)
882 sizeof(hostdata->madapter_info), 884 sizeof(hostdata->madapter_info),
883 DMA_BIDIRECTIONAL); 885 DMA_BIDIRECTIONAL);
884 } 886 }
887 spin_unlock_irqrestore(hostdata->host->host_lock, flags);
885}; 888};
886 889
887/** 890/**
@@ -1357,6 +1360,7 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata,
1357{ 1360{
1358 struct viosrp_host_config *host_config; 1361 struct viosrp_host_config *host_config;
1359 struct srp_event_struct *evt_struct; 1362 struct srp_event_struct *evt_struct;
1363 unsigned long flags;
1360 dma_addr_t addr; 1364 dma_addr_t addr;
1361 int rc; 1365 int rc;
1362 1366
@@ -1388,7 +1392,9 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata,
1388 } 1392 }
1389 1393
1390 init_completion(&evt_struct->comp); 1394 init_completion(&evt_struct->comp);
1395 spin_lock_irqsave(hostdata->host->host_lock, flags);
1391 rc = ibmvscsi_send_srp_event(evt_struct, hostdata, init_timeout * 2); 1396 rc = ibmvscsi_send_srp_event(evt_struct, hostdata, init_timeout * 2);
1397 spin_unlock_irqrestore(hostdata->host->host_lock, flags);
1392 if (rc == 0) 1398 if (rc == 0)
1393 wait_for_completion(&evt_struct->comp); 1399 wait_for_completion(&evt_struct->comp);
1394 dma_unmap_single(hostdata->dev, addr, length, DMA_BIDIRECTIONAL); 1400 dma_unmap_single(hostdata->dev, addr, length, DMA_BIDIRECTIONAL);