Skip to content

Commit

Permalink
Target/sbc: Initialize COMPARE_AND_WRITE write_sg scatterlist
Browse files Browse the repository at this point in the history
When compiled with CONFIG_DEBUG_SG set, uninitialized SGL leads
to BUG() in compare_and_write_callback().

Signed-off-by: Martin Svec <martin.svec@zoner.cz>
Cc: <stable@vger.kernel.org> #3.12+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
MartySvec authored and Nicholas Bellinger committed Apr 7, 2014
1 parent 9d2e59f commit a1e1774
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/target/target_core_sbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,14 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd)
goto out;
}

write_sg = kzalloc(sizeof(struct scatterlist) * cmd->t_data_nents,
write_sg = kmalloc(sizeof(struct scatterlist) * cmd->t_data_nents,
GFP_KERNEL);
if (!write_sg) {
pr_err("Unable to allocate compare_and_write sg\n");
ret = TCM_OUT_OF_RESOURCES;
goto out;
}
sg_init_table(write_sg, cmd->t_data_nents);
/*
* Setup verify and write data payloads from total NumberLBAs.
*/
Expand Down

0 comments on commit a1e1774

Please sign in to comment.