Patch "scsi: qla2xxx: Fix use after free in bsg" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scsi: qla2xxx: Fix use after free in bsg

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-qla2xxx-fix-use-after-free-in-bsg.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ad3edb1f18274c6c94f1d4d9de555186081745fb
Author: Quinn Tran <qutran@xxxxxxxxxxx>
Date:   Mon Mar 29 01:52:22 2021 -0700

    scsi: qla2xxx: Fix use after free in bsg
    
    [ Upstream commit 2ce35c0821afc2acd5ee1c3f60d149f8b2520ce8 ]
    
    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@xxxxxxxxxxx
    Reviewed-by: Himanshu Madhani <himanshu.madhani@xxxxxxxxxx>
    Signed-off-by: Quinn Tran <qutran@xxxxxxxxxxx>
    Signed-off-by: Saurav Kashyap <skashyap@xxxxxxxxxxx>
    Signed-off-by: Nilesh Javali <njavali@xxxxxxxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 23b604832a54..7fa085969a63 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -24,10 +24,11 @@ void qla2x00_bsg_job_done(srb_t *sp, int res)
 	struct bsg_job *bsg_job = sp->u.bsg_job;
 	struct fc_bsg_reply *bsg_reply = bsg_job->reply;
 
+	sp->free(sp);
+
 	bsg_reply->result = res;
 	bsg_job_done(bsg_job, bsg_reply->result,
 		       bsg_reply->reply_payload_rcv_len);
-	sp->free(sp);
 }
 
 void qla2x00_bsg_sp_free(srb_t *sp)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux