提交 7a2962c7 编写于 作者: E Eddie Wai 提交者: James Bottomley

[SCSI] bnx2i: Added mutex lock protection to conn_get_param

Added net_dev mutex lock protection before accessing the csk
parameters.
Signed-off-by: NEddie Wai <eddie.wai@broadcom.com>
Reviewed-by: NBenjamin Li <benli@broadcom.com>
Reviewed-by: NMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
上级 252e4480
...@@ -1461,21 +1461,28 @@ static int bnx2i_conn_get_param(struct iscsi_cls_conn *cls_conn, ...@@ -1461,21 +1461,28 @@ static int bnx2i_conn_get_param(struct iscsi_cls_conn *cls_conn,
struct bnx2i_conn *bnx2i_conn = conn->dd_data; struct bnx2i_conn *bnx2i_conn = conn->dd_data;
int len = 0; int len = 0;
if (!(bnx2i_conn && bnx2i_conn->ep && bnx2i_conn->ep->hba))
goto out;
switch (param) { switch (param) {
case ISCSI_PARAM_CONN_PORT: case ISCSI_PARAM_CONN_PORT:
if (bnx2i_conn->ep) mutex_lock(&bnx2i_conn->ep->hba->net_dev_lock);
if (bnx2i_conn->ep->cm_sk)
len = sprintf(buf, "%hu\n", len = sprintf(buf, "%hu\n",
bnx2i_conn->ep->cm_sk->dst_port); bnx2i_conn->ep->cm_sk->dst_port);
mutex_unlock(&bnx2i_conn->ep->hba->net_dev_lock);
break; break;
case ISCSI_PARAM_CONN_ADDRESS: case ISCSI_PARAM_CONN_ADDRESS:
if (bnx2i_conn->ep) mutex_lock(&bnx2i_conn->ep->hba->net_dev_lock);
if (bnx2i_conn->ep->cm_sk)
len = sprintf(buf, "%pI4\n", len = sprintf(buf, "%pI4\n",
&bnx2i_conn->ep->cm_sk->dst_ip); &bnx2i_conn->ep->cm_sk->dst_ip);
mutex_unlock(&bnx2i_conn->ep->hba->net_dev_lock);
break; break;
default: default:
return iscsi_conn_get_param(cls_conn, param, buf); return iscsi_conn_get_param(cls_conn, param, buf);
} }
out:
return len; return len;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册