From: Mark Rustad Date: Sat, 14 Jul 2012 01:18:04 +0000 (-0700) Subject: tcm_fc: Fix crash seen with aborts and large reads X-Git-Tag: accepted/tizen/common/20141203.182822~4201^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3cc5d2a6b9a2fd1bf024aa5e52dd22961eecaf13;p=platform%2Fkernel%2Flinux-arm64.git tcm_fc: Fix crash seen with aborts and large reads This patch fixes a crash seen when large reads have their exchange aborted by either timing out or being reset. Because the exchange abort results in the seq pointer being set to NULL, because the sequence is no longer valid, it must not be dereferenced. This patch changes the function ft_get_task_tag to return ~0 if it is unable to get the tag for this reason. Because the get_task_tag interface provides no means of returning an error, this seems like the best way to fix this issue at the moment. Signed-off-by: Mark Rustad Cc: Signed-off-by: Nicholas Bellinger --- diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index f03fb97..5b65f33 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c @@ -230,6 +230,8 @@ u32 ft_get_task_tag(struct se_cmd *se_cmd) { struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); + if (cmd->aborted) + return ~0; return fc_seq_exch(cmd->seq)->rxid; }