mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-14 22:56:41 +07:00
iscsi-target: Avoid holding ->tpg_state_lock during param update
As originally reported by Jia-Ju, iscsit_tpg_enable_portal_group() holds iscsi_portal_group->tpg_state_lock while updating AUTHMETHOD via iscsi_update_param_value(), which performs a GFP_KERNEL allocation. However, since iscsit_tpg_enable_portal_group() is already protected by iscsit_get_tpg() -> iscsi_portal_group->tpg_access_lock in it's parent caller, ->tpg_state_lock only needs to be held when setting TPG_STATE_ACTIVE. Reported-by: Jia-Ju Bai <baijiaju1990@163.com> Reviewed-by: Jia-Ju Bai <baijiaju1990@163.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
parent
9ae0e9ade5
commit
eceb4459df
@ -311,11 +311,9 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg)
|
||||
struct iscsi_tiqn *tiqn = tpg->tpg_tiqn;
|
||||
int ret;
|
||||
|
||||
spin_lock(&tpg->tpg_state_lock);
|
||||
if (tpg->tpg_state == TPG_STATE_ACTIVE) {
|
||||
pr_err("iSCSI target portal group: %hu is already"
|
||||
" active, ignoring request.\n", tpg->tpgt);
|
||||
spin_unlock(&tpg->tpg_state_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
/*
|
||||
@ -324,10 +322,8 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg)
|
||||
* is enforced (as per default), and remove the NONE option.
|
||||
*/
|
||||
param = iscsi_find_param_from_key(AUTHMETHOD, tpg->param_list);
|
||||
if (!param) {
|
||||
spin_unlock(&tpg->tpg_state_lock);
|
||||
if (!param)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (tpg->tpg_attrib.authentication) {
|
||||
if (!strcmp(param->value, NONE)) {
|
||||
@ -341,6 +337,7 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg)
|
||||
goto err;
|
||||
}
|
||||
|
||||
spin_lock(&tpg->tpg_state_lock);
|
||||
tpg->tpg_state = TPG_STATE_ACTIVE;
|
||||
spin_unlock(&tpg->tpg_state_lock);
|
||||
|
||||
@ -353,7 +350,6 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg)
|
||||
return 0;
|
||||
|
||||
err:
|
||||
spin_unlock(&tpg->tpg_state_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user