Skip to content

Commit

Permalink
iscsi-target: Fix iscsit_allocate_se_cmd_for_tmr failure path bugs
Browse files Browse the repository at this point in the history
This patch fixes two bugs in allocation failure handling in
iscsit_allocate_se_cmd_for_tmr():

This first reported by DanC is a free-after call to transport_free_se_cmd(), this
patch drops the transport_free_se_cmd() call all together, as iscsit_release_cmd()
will release existing allocations as expected.

The second is a bug where iscsi_cmd_t was being leaked on a cmd->tmr_req allocation
failure, so make this jump to iscsit_release_cmd() as well.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
  • Loading branch information
error27 authored and Nicholas Bellinger committed Aug 22, 2011
1 parent 6626a05 commit ba77366
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/target/iscsi/iscsi_target_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ struct iscsi_cmd *iscsit_allocate_se_cmd_for_tmr(
if (!cmd->tmr_req) {
pr_err("Unable to allocate memory for"
" Task Management command!\n");
return NULL;
goto out;
}
/*
* TASK_REASSIGN for ERL=2 / connection stays inside of
Expand Down Expand Up @@ -298,8 +298,6 @@ struct iscsi_cmd *iscsit_allocate_se_cmd_for_tmr(
return cmd;
out:
iscsit_release_cmd(cmd);
if (se_cmd)
transport_free_se_cmd(se_cmd);
return NULL;
}

Expand Down

0 comments on commit ba77366

Please sign in to comment.