scsi/lsi53c895a: really fix use-after-free in lsi_do_msgout (CVE-2022-0216)
authorMauro Matteo Cascella <mcascell@redhat.com>
Mon, 11 Jul 2022 12:33:16 +0000 (14:33 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 13 Jul 2022 14:58:57 +0000 (16:58 +0200)
commit4367a20cc442c56b05611b4224de9a61908f9eac
treef2bfd3dbeecd71996175f44fa1c01de8f55e58ad
parent8e3d85d36b77f11ad7bded3a2d48c1f0cc334f82
scsi/lsi53c895a: really fix use-after-free in lsi_do_msgout (CVE-2022-0216)

Set current_req to NULL, not current_req->req, to prevent reusing a free'd
buffer in case of repeated SCSI cancel requests.  Also apply the fix to
CLEAR QUEUE and BUS DEVICE RESET messages as well, since they also cancel
the request.

Thanks to Alexander Bulekov for providing a reproducer.

Fixes: CVE-2022-0216
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/972
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
Tested-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20220711123316.421279-1-mcascell@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/lsi53c895a.c
tests/qtest/fuzz-lsi53c895a-test.c