diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index cfd9ce21d..88b37eb3d 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -757,6 +757,15 @@ static int dev_user_parse(struct scst_cmd *cmd) res = SCST_CMD_STATE_NEED_THREAD_CTX; goto out; } + if (rc < 0) { + /* + * May have already called e.g. scst_set_cmd_error(); + * too late to try user parse without cleaning up + * first. + */ + PRINT_ERROR("PARSE failed (ucmd %p, rc %d)", ucmd, rc); + goto out_error; + } fallthrough; case SCST_USER_PARSE_CALL: