Quinn Tran 2ce35c0821 scsi: qla2xxx: Fix use after free in bsg
On bsg command completion, bsg_job_done() was called while qla driver
continued to access the bsg_job buffer. bsg_job_done() would free up
resources that ended up being reused by other task while the driver
continued to access the buffers. As a result, driver was reading garbage
data.

localhost kernel: BUG: KASAN: use-after-free in sg_next+0x64/0x80
localhost kernel: Read of size 8 at addr ffff8883228a3330 by task swapper/26/0
localhost kernel:
localhost kernel: CPU: 26 PID: 0 Comm: swapper/26 Kdump:
loaded Tainted: G          OE    --------- -  - 4.18.0-193.el8.x86_64+debug #1
localhost kernel: Hardware name: HP ProLiant DL360
Gen9/ProLiant DL360 Gen9, BIOS P89 08/12/2016
localhost kernel: Call Trace:
localhost kernel: <IRQ>
localhost kernel: dump_stack+0x9a/0xf0
localhost kernel: print_address_description.cold.3+0x9/0x23b
localhost kernel: kasan_report.cold.4+0x65/0x95
localhost kernel: debug_dma_unmap_sg.part.12+0x10d/0x2d0
localhost kernel: qla2x00_bsg_sp_free+0xaf6/0x1010 [qla2xxx]

Link: https://lore.kernel.org/r/20210329085229.4367-6-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-03-29 22:38:58 -04:00
..
2021-01-22 21:14:09 -05:00
2021-03-24 23:06:27 -04:00
2021-03-24 22:58:33 -04:00
2021-03-24 22:54:24 -04:00
2020-12-16 13:34:31 -08:00
2020-03-11 23:07:59 -04:00
2021-03-24 22:33:37 -04:00
2021-03-24 23:07:58 -04:00
2021-03-24 22:58:06 -04:00
2021-01-13 00:15:13 -05:00
2021-01-22 21:14:07 -05:00
2021-01-22 21:14:08 -05:00
2021-01-22 21:14:07 -05:00
2021-02-22 10:24:58 -08:00
2021-02-22 10:24:58 -08:00
2018-06-19 22:02:25 -04:00
2021-01-22 21:14:08 -05:00
2020-02-24 14:54:25 -05:00
2020-03-11 23:07:59 -04:00
2021-03-24 23:07:14 -04:00
2020-09-02 22:49:06 -04:00
2020-08-23 17:36:59 -05:00
2018-11-06 21:31:28 -05:00
2020-12-07 20:24:09 -05:00
2021-01-22 21:14:07 -05:00
2020-10-14 15:15:35 -07:00
2021-01-26 22:11:17 -05:00
2020-12-07 20:24:09 -05:00
2020-12-07 20:24:09 -05:00
2020-08-23 17:36:59 -05:00
2020-10-14 15:15:35 -07:00
2021-03-24 23:03:43 -04:00
2021-02-22 10:24:58 -08:00
2018-06-19 22:02:25 -04:00
2020-12-01 14:53:39 -07:00
2021-03-18 23:35:54 -04:00
2020-10-14 15:15:35 -07:00
2019-07-11 15:14:01 -07:00
2020-02-24 15:01:57 -05:00
2021-01-22 21:14:10 -05:00
2020-10-14 15:15:35 -07:00
2021-01-22 21:14:12 -05:00
2019-07-11 15:14:01 -07:00