]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/scsi/qla2xxx/qla_target.c
qla2xxx: Don't leak commands we give up on in qlt_do_work()
[karo-tx-linux.git] / drivers / scsi / qla2xxx / qla_target.c
index c263f9016debe30988b6dfc02ce57788254e1748..e91292099a099b5950d9c12650e8fa1ef6fcb726 100644 (file)
@@ -2725,10 +2725,12 @@ static void qlt_do_work(struct work_struct *work)
 out_term:
        ql_dbg(ql_dbg_tgt_mgt, vha, 0xf020, "Terminating work cmd %p", cmd);
        /*
-        * cmd has not sent to target yet, so pass NULL as the second argument
+        * cmd has not sent to target yet, so pass NULL as the second
+        * argument to qlt_send_term_exchange() and free the memory here.
         */
        spin_lock_irqsave(&ha->hardware_lock, flags);
        qlt_send_term_exchange(vha, NULL, &cmd->atio, 1);
+       kmem_cache_free(qla_tgt_cmd_cachep, cmd);
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
        if (sess)
                ha->tgt.tgt_ops->put_sess(sess);