]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/nvme: separate 'serial' property for VFs
authorMinwoo Im <minwoo.im@samsung.com>
Tue, 9 Jan 2024 02:29:53 +0000 (11:29 +0900)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 13 Mar 2024 17:34:30 +0000 (20:34 +0300)
commit2d281e030d02952a4fcca984275e2e8e6cae5d5f
tree0e3929803842a959d5c492f8147ff48600b3e7b4
parent35ca0f7cbc1c541d0efcc9e41c6405200087e857
hw/nvme: separate 'serial' property for VFs

Currently, when a VF is created, it uses the 'params' object of the PF
as it is. In other words, the 'params.serial' string memory area is also
shared. In this situation, if the VF is removed from the system, the
PF's 'params.serial' object is released with object_finalize() followed
by object_property_del_all() which release the memory for 'serial'
property. If that happens, the next VF created will inherit a serial
from a corrupted memory area.

If this happens, an error will occur when comparing subsys->serial and
n->params.serial in the nvme_subsys_register_ctrl() function.

Cc: qemu-stable@nongnu.org
Fixes: 44c2c09488db ("hw/nvme: Add support for SR-IOV")
Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
(cherry picked from commit 4f0a4a3d5854824e5c5eccf353d4a1f4f749a29d)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/nvme/ctrl.c