Commit 8ae757d0 authored by Joern Engel's avatar Joern Engel Committed by Nicholas Bellinger

iscsi-target: avoid NULL pointer in iscsi_copy_param_list failure

In iscsi_copy_param_list() a failed iscsi_param_list memory allocation
currently invokes iscsi_release_param_list() to cleanup, and will promptly
trigger a NULL pointer dereference.

Instead, go ahead and return for the first iscsi_copy_param_list()
failure case.

Found by coverity.
Signed-off-by: default avatarJoern Engel <joern@logfs.org>
Cc: <stable@vger.kernel.org> # v3.1+
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent b53b0d99
...@@ -601,7 +601,7 @@ int iscsi_copy_param_list( ...@@ -601,7 +601,7 @@ int iscsi_copy_param_list(
param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL);
if (!param_list) { if (!param_list) {
pr_err("Unable to allocate memory for struct iscsi_param_list.\n"); pr_err("Unable to allocate memory for struct iscsi_param_list.\n");
goto err_out; return -1;
} }
INIT_LIST_HEAD(&param_list->param_list); INIT_LIST_HEAD(&param_list->param_list);
INIT_LIST_HEAD(&param_list->extra_response_list); INIT_LIST_HEAD(&param_list->extra_response_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment