[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/14] hw/i386/vmport: Assert vmport initialized before registeri
From: |
Liran Alon |
Subject: |
[PATCH 14/14] hw/i386/vmport: Assert vmport initialized before registering commands |
Date: |
Tue, 10 Mar 2020 01:54:11 +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 95d4a23ce9ba..659a323e8448 100644
--- a/hw/i386/vmport.c
+++ b/hw/i386/vmport.c
@@ -68,6 +68,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
- Re: [PATCH 05/14] hw/i386/vmport: Report VMX type in CMD_GETVERSION, (continued)
[PATCH 09/14] hw/i386/vmport: Add support for CMD_GETTIMEFULL, Liran Alon, 2020/03/09
[PATCH 10/14] hw/i386/vmport: Add support for CMD_GET_VCPU_INFO, Liran Alon, 2020/03/09
[PATCH 11/14] hw/i386/vmport: Allow x2apic without IR, Liran Alon, 2020/03/09
[PATCH 12/14] i386/cpu: Store LAPIC bus frequency in CPU structure, Liran Alon, 2020/03/09
[PATCH 14/14] hw/i386/vmport: Assert vmport initialized before registering commands,
Liran Alon <=
[PATCH 13/14] hw/i386/vmport: Add support for CMD_GETHZ, Liran Alon, 2020/03/09
[PATCH 06/14] hw/i386/vmport: Define enum for all commands, Liran Alon, 2020/03/09
- Re: [PATCH 06/14] hw/i386/vmport: Define enum for all commands, Michael S. Tsirkin, 2020/03/10
- Re: [PATCH 06/14] hw/i386/vmport: Define enum for all commands, Liran Alon, 2020/03/10
- Re: [PATCH 06/14] hw/i386/vmport: Define enum for all commands, Michael S. Tsirkin, 2020/03/10
- Re: [PATCH 06/14] hw/i386/vmport: Define enum for all commands, Liran Alon, 2020/03/10
- Re: [PATCH 06/14] hw/i386/vmport: Define enum for all commands, Michael S. Tsirkin, 2020/03/10
- Re: [PATCH 06/14] hw/i386/vmport: Define enum for all commands, Liran Alon, 2020/03/10