scsi: qla2xxx: Fix use-after-free issues in qla2xxx_qpair_sp_free_dma()
authorBart Van Assche <bvanassche@acm.org>
Wed, 17 Apr 2019 21:44:25 +0000 (14:44 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 29 Apr 2019 21:24:50 +0000 (17:24 -0400)
commitd8f945bf8096375f458683b5718722a2d5dda2f0
tree16e4abb84efc04039aec9d9ce7781b067c013a30
parent24afabdbd0b3553963a2bbf465895492b14d1107
scsi: qla2xxx: Fix use-after-free issues in qla2xxx_qpair_sp_free_dma()

The current order for freeing memory is as follows:
- struct crc_context itself.
- struct crc_context member pointers.

Change the freeing order into the following:
- struct crc_context member pointers.
- struct crc_context itself.

Detected by Coverity.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Fixes: 50b812755e97 ("scsi: qla2xxx: Fix DMA error when the DIF sg buffer crosses 4GB boundary") # v5.1-rc1.
Fixes: d74595278f4a ("scsi: qla2xxx: Add multiple queue pair functionality.") # v4.10.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_os.c