Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312683
b: refs/heads/master
c: 617a0c2
h: refs/heads/master
i:
  312681: 7d7faa8
  312679: 936fd40
v: v3
  • Loading branch information
Andy Grover authored and Nicholas Bellinger committed Jul 17, 2012
1 parent 27eb785 commit 103a9e7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2dca673b46c586d8e5dd0c8e3a582b51a1d7907d
refs/heads/master: 617a0c2eb316c4d3c8a67255f85c7cf676ab59a9
2 changes: 1 addition & 1 deletion trunk/drivers/target/iscsi/iscsi_target_parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ int iscsi_update_param_value(struct iscsi_param *param, char *value)
param->value = kzalloc(strlen(value) + 1, GFP_KERNEL);
if (!param->value) {
pr_err("Unable to allocate memory for value.\n");
return -1;
return -ENOMEM;
}

memcpy(param->value, value, strlen(value));
Expand Down
25 changes: 15 additions & 10 deletions trunk/drivers/target/iscsi/iscsi_target_tpg.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg)
{
struct iscsi_param *param;
struct iscsi_tiqn *tiqn = tpg->tpg_tiqn;
int ret;

spin_lock(&tpg->tpg_state_lock);
if (tpg->tpg_state == TPG_STATE_ACTIVE) {
Expand All @@ -319,19 +320,19 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg)
param = iscsi_find_param_from_key(AUTHMETHOD, tpg->param_list);
if (!param) {
spin_unlock(&tpg->tpg_state_lock);
return -ENOMEM;
return -EINVAL;
}

if (ISCSI_TPG_ATTRIB(tpg)->authentication) {
if (!strcmp(param->value, NONE))
if (iscsi_update_param_value(param, CHAP) < 0) {
spin_unlock(&tpg->tpg_state_lock);
return -ENOMEM;
}
if (iscsit_ta_authentication(tpg, 1) < 0) {
spin_unlock(&tpg->tpg_state_lock);
return -ENOMEM;
if (!strcmp(param->value, NONE)) {
ret = iscsi_update_param_value(param, CHAP);
if (ret)
goto err;
}

ret = iscsit_ta_authentication(tpg, 1);
if (ret < 0)
goto err;
}

tpg->tpg_state = TPG_STATE_ACTIVE;
Expand All @@ -344,6 +345,10 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg)
spin_unlock(&tiqn->tiqn_tpg_lock);

return 0;

err:
spin_unlock(&tpg->tpg_state_lock);
return ret;
}

int iscsit_tpg_disable_portal_group(struct iscsi_portal_group *tpg, int force)
Expand Down Expand Up @@ -558,7 +563,7 @@ int iscsit_ta_authentication(struct iscsi_portal_group *tpg, u32 authentication)
if ((authentication != 1) && (authentication != 0)) {
pr_err("Illegal value for authentication parameter:"
" %u, ignoring request.\n", authentication);
return -1;
return -EINVAL;
}

memset(buf1, 0, sizeof(buf1));
Expand Down

0 comments on commit 103a9e7

Please sign in to comment.