• Bart Van Assche's avatar
    scsi: target/iscsi: Detect conn_cmd_list corruption early · b0055aca
    Bart Van Assche authored
    Certain behavior of an initiator can cause the target driver to send both a
    reject and a SCSI response. If that happens two target_put_sess_cmd() calls
    will occur without the command having been removed from conn_cmd_list. In
    other words, conn_cmd_list will get corrupted once the freed memory is
    reused. Although the Linux kernel can detect list corruption if list
    debugging is enabled, in this case the context in which list corruption is
    detected is not related to the context that caused list corruption.  Hence
    add WARN_ON() statements that report the context that is causing list
    corruption.
    
    Cc: Mike Christie <mchristi@redhat.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Hannes Reinecke <hare@suse.de>
    Cc: Nicholas Bellinger <nab@linux-iscsi.org>
    Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    b0055aca
iscsi_target_util.c 35.2 KB