diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 8885da4d2..8f2690835 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -2055,7 +2055,7 @@ void scst_free_cmd(struct scst_cmd *cmd) if (!cmd->tgt_data_buf_alloced) scst_check_restore_sg_buff(cmd); - if (cmd->tgtt->on_free_cmd != NULL) { + if ((cmd->tgtt->on_free_cmd != NULL) && likely(!cmd->internal)) { TRACE_DBG("Calling target's on_free_cmd(%p)", cmd); cmd->tgtt->on_free_cmd(cmd); TRACE_DBG("%s", "Target's on_free_cmd() returned");