[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 16/16] hw/i386/vmport: Assert vmport initialized before regist
From: |
Liran Alon |
Subject: |
[PATCH v2 16/16] hw/i386/vmport: Assert vmport initialized before registering commands |
Date: |
Tue, 10 Mar 2020 18:53:32 +0200 |
vmport_register() is also called from other modules such as vmmouse.
Therefore, these modules rely that vmport is realized before those call
sites. If this is violated, vmport_register() will NULL-deref.
To make such issues easier to debug, assert in vmport_register() that
vmport is already realized.
Reviewed-by: Nikita Leshenko <address@hidden>
Signed-off-by: Liran Alon <address@hidden>
---
hw/i386/vmport.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c
index 76fd49c52058..8d3d268bfd7e 100644
--- a/hw/i386/vmport.c
+++ b/hw/i386/vmport.c
@@ -72,6 +72,8 @@ static VMPortState *port_state;
void vmport_register(VMPortCommand command, VMPortReadFunc *func, void *opaque)
{
assert(command < VMPORT_ENTRIES);
+ assert(port_state);
+
trace_vmport_register(command, func, opaque);
port_state->func[command] = func;
port_state->opaque[command] = opaque;
--
2.20.1
- [PATCH v2 05/16] hw/i386/vmport: Introduce vmx-version property, (continued)
- [PATCH v2 05/16] hw/i386/vmport: Introduce vmx-version property, Liran Alon, 2020/03/10
- [PATCH v2 06/16] hw/i386/vmport: Report VMX type in CMD_GETVERSION, Liran Alon, 2020/03/10
- [PATCH v2 07/16] hw/i386/vmport: Introduce vmport.h, Liran Alon, 2020/03/10
- [PATCH v2 09/16] hw/i386/vmport: Add support for CMD_GETBIOSUUID, Liran Alon, 2020/03/10
- [PATCH v2 10/16] hw/i386/vmport: Add support for CMD_GETTIME, Liran Alon, 2020/03/10
- [PATCH v2 11/16] hw/i386/vmport: Add support for CMD_GETTIMEFULL, Liran Alon, 2020/03/10
- [PATCH v2 12/16] hw/i386/vmport: Add support for CMD_GET_VCPU_INFO, Liran Alon, 2020/03/10
- [PATCH v2 13/16] hw/i386/vmport: Allow x2apic without IR, Liran Alon, 2020/03/10
- [PATCH v2 14/16] i386/cpu: Store LAPIC bus frequency in CPU structure, Liran Alon, 2020/03/10
- [PATCH v2 15/16] hw/i386/vmport: Add support for CMD_GETHZ, Liran Alon, 2020/03/10
- [PATCH v2 16/16] hw/i386/vmport: Assert vmport initialized before registering commands,
Liran Alon <=
- [PATCH v2 08/16] hw/i386/vmport: Define enum for all commands, Liran Alon, 2020/03/10
- Re: [PATCH v2 00/16]: hw/i386/vmport: Bug fixes and improvements, Michael S. Tsirkin, 2020/03/10
- Re: [PATCH v2 00/16]: hw/i386/vmport: Bug fixes and improvements, Liran Alon, 2020/03/10
- Re: [PATCH v2 00/16]: hw/i386/vmport: Bug fixes and improvements, Michael S. Tsirkin, 2020/03/10
- Re: [PATCH v2 00/16]: hw/i386/vmport: Bug fixes and improvements, Liran Alon, 2020/03/10
- Re: [PATCH v2 00/16]: hw/i386/vmport: Bug fixes and improvements, Michael S. Tsirkin, 2020/03/10
- Re: [PATCH v2 00/16]: hw/i386/vmport: Bug fixes and improvements, Liran Alon, 2020/03/10
- Re: [PATCH v2 00/16]: hw/i386/vmport: Bug fixes and improvements, Michael S. Tsirkin, 2020/03/10
- Re: [PATCH v2 00/16]: hw/i386/vmport: Bug fixes and improvements, Liran Alon, 2020/03/10
- Re: [PATCH v2 00/16]: hw/i386/vmport: Bug fixes and improvements, Michael S. Tsirkin, 2020/03/11