From 670352ba89ceda98e6a990472706a2c207389bc4 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 15 Jan 2015 08:58:39 +0000 Subject: [PATCH] scst_targ: Avoid triggering a kernel panic if dev_user_parse() returns SCST_CMD_STATE_STOP Reported-by: Ilan Steinberg git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5968 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_targ.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 4ab7043a2..11311c1b9 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -635,7 +635,7 @@ static int scst_parse_cmd(struct scst_cmd *cmd) TRACE_MGMT_DBG("Dev handler %s parse() needs thread " "context, rescheduling", devt->name); res = SCST_CMD_STATE_RES_NEED_THREAD; - goto out; + goto check_compl; } TRACE_DBG("Calling dev handler %s parse(%p)", @@ -939,11 +939,11 @@ set_res: TRACE_DBG_FLAG(TRACE_DEBUG|TRACE_MINOR, "Atomic context and " "non-WRITE data direction, rescheduling (cmd %p)", cmd); res = SCST_CMD_STATE_RES_NEED_THREAD; - goto out; + goto check_compl; } #endif -out: +check_compl: #ifdef CONFIG_SCST_EXTRACHECKS if (unlikely(cmd->completed)) { /* Command completed with error */ @@ -1000,6 +1000,7 @@ out: } } +out: TRACE_EXIT_HRES(res); return res; @@ -1010,7 +1011,7 @@ out_hw_error: out_done: scst_set_cmd_abnormal_done_state(cmd); res = SCST_CMD_STATE_RES_CONT_SAME; - goto out; + goto check_compl; } static void scst_set_write_len(struct scst_cmd *cmd)