diff options
author | Eddie Wai <eddie.wai@broadcom.com> | 2010-11-23 18:29:26 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-12-21 13:24:13 -0500 |
commit | 7a2962c77ced218faeeb7b5eda48abfebc578df2 (patch) | |
tree | 9aa5da25ba6ae61ad0d383869621a019edc12b6f /drivers/scsi/bnx2i | |
parent | 252e44805bcfff5de2e05dd126f69a18e0b760f0 (diff) |
[SCSI] bnx2i: Added mutex lock protection to conn_get_param
Added net_dev mutex lock protection before accessing the csk
parameters.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bnx2i')
-rw-r--r-- | drivers/scsi/bnx2i/bnx2i_iscsi.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index a2c9b1f2ea5c..07dd4f9036f0 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c | |||
@@ -1461,21 +1461,28 @@ static int bnx2i_conn_get_param(struct iscsi_cls_conn *cls_conn, | |||
1461 | struct bnx2i_conn *bnx2i_conn = conn->dd_data; | 1461 | struct bnx2i_conn *bnx2i_conn = conn->dd_data; |
1462 | int len = 0; | 1462 | int len = 0; |
1463 | 1463 | ||
1464 | if (!(bnx2i_conn && bnx2i_conn->ep && bnx2i_conn->ep->hba)) | ||
1465 | goto out; | ||
1466 | |||
1464 | switch (param) { | 1467 | switch (param) { |
1465 | case ISCSI_PARAM_CONN_PORT: | 1468 | case ISCSI_PARAM_CONN_PORT: |
1466 | if (bnx2i_conn->ep) | 1469 | mutex_lock(&bnx2i_conn->ep->hba->net_dev_lock); |
1470 | if (bnx2i_conn->ep->cm_sk) | ||
1467 | len = sprintf(buf, "%hu\n", | 1471 | len = sprintf(buf, "%hu\n", |
1468 | bnx2i_conn->ep->cm_sk->dst_port); | 1472 | bnx2i_conn->ep->cm_sk->dst_port); |
1473 | mutex_unlock(&bnx2i_conn->ep->hba->net_dev_lock); | ||
1469 | break; | 1474 | break; |
1470 | case ISCSI_PARAM_CONN_ADDRESS: | 1475 | case ISCSI_PARAM_CONN_ADDRESS: |
1471 | if (bnx2i_conn->ep) | 1476 | mutex_lock(&bnx2i_conn->ep->hba->net_dev_lock); |
1477 | if (bnx2i_conn->ep->cm_sk) | ||
1472 | len = sprintf(buf, "%pI4\n", | 1478 | len = sprintf(buf, "%pI4\n", |
1473 | &bnx2i_conn->ep->cm_sk->dst_ip); | 1479 | &bnx2i_conn->ep->cm_sk->dst_ip); |
1480 | mutex_unlock(&bnx2i_conn->ep->hba->net_dev_lock); | ||
1474 | break; | 1481 | break; |
1475 | default: | 1482 | default: |
1476 | return iscsi_conn_get_param(cls_conn, param, buf); | 1483 | return iscsi_conn_get_param(cls_conn, param, buf); |
1477 | } | 1484 | } |
1478 | 1485 | out: | |
1479 | return len; | 1486 | return len; |
1480 | } | 1487 | } |
1481 | 1488 | ||