]> 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 18:10:00 +0000 (21:10 +0300)
commit61f6b12cf3278a67677f17dea7278a70fb2069ac
tree476d9211b2aac3829279758b5753e15282e5d43d
parentd68a13c6726611be70a2856b71efac8cdce0689e
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