]> git.ipfire.org Git - thirdparty/qemu.git/commit
scsi-generic: fix buffer overflow on block limits inquiry
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 10 May 2023 16:15:25 +0000 (18:15 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 18 May 2023 17:46:29 +0000 (20:46 +0300)
commit1e029102e6b6b176d692944d9df94c6b46185912
tree7a3556a36fbdcd1450d117d3ff23e93685a4ce98
parentc283a4bc7621b37fc62fd0eac1932796d2de84ab
scsi-generic: fix buffer overflow on block limits inquiry

Using linux 6.x guest, at boot time, an inquiry on a scsi-generic
device makes qemu crash.  This is caused by a buffer overflow when
scsi-generic patches the block limits VPD page.

Do the operations on a temporary on-stack buffer that is guaranteed
to be large enough.

Reported-by: Théo Maillart <tmaillart@freebox.fr>
Analyzed-by: Théo Maillart <tmaillart@freebox.fr>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 9bd634b2f5e2f10fe35d7609eb83f30583f2e15a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/scsi/scsi-generic.c