From 00ad4c4e81ba8bfcc52c42ec9d72ff84a081fb82 Mon Sep 17 00:00:00 2001 From: Nicholas Bellinger Date: Sat, 25 Feb 2012 01:43:04 -0800 Subject: [PATCH] tcm_fc: Handle target_submit_tmr allocation failure This patch makes ft_send_tm() handle target_submit_tmr() allocation failures via an ft_send_resp_code_and_free() w/ FCP_TMF_FAILED status. Cc: Andy Grover Cc: Kiran Patil Cc: Arun Easi Signed-off-by: Nicholas Bellinger --- drivers/target/tcm_fc/tfc_cmd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index ed69c0deb102..be3319af5d8b 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c @@ -354,6 +354,7 @@ static void ft_send_resp_code_and_free(struct ft_cmd *cmd, static void ft_send_tm(struct ft_cmd *cmd) { struct fcp_cmnd *fcp; + int rc; u8 tm_func; fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); @@ -384,9 +385,11 @@ static void ft_send_tm(struct ft_cmd *cmd) return; } - target_submit_tmr(&cmd->se_cmd, cmd->sess->se_sess, + rc = target_submit_tmr(&cmd->se_cmd, cmd->sess->se_sess, &cmd->ft_sense_buffer[0], scsilun_to_int(&fcp->fc_lun), cmd, tm_func, 0); + if (rc < 0) + ft_send_resp_code_and_free(cmd, FCP_TMF_FAILED); } /* -- 2.11.0