* [PATCH] ui/spice-display: check NULL pointer in interface_release_resource()
@ 2021-05-20 10:58 Mauro Matteo Cascella
2021-05-21 6:24 ` P J P
0 siblings, 1 reply; 2+ messages in thread
From: Mauro Matteo Cascella @ 2021-05-20 10:58 UTC (permalink / raw)
To: qemu-devel; +Cc: ini.universe, mcascell, kraxel, ppandit
Check rext.info to avoid potential NULL pointer dereference. A similar check
exists in interface_release_resource() in hw/display/qxl.c.
Reported-by: Yu Lu <ini.universe@gmail.com>
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
---
ui/spice-display.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ui/spice-display.c b/ui/spice-display.c
index d22781a23d..f59c69882d 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -561,6 +561,10 @@ static void interface_release_resource(QXLInstance *sin,
SimpleSpiceCursor *cursor;
QXLCommandExt *ext;
+ if (!rext.info) {
+ return;
+ }
+
ext = (void *)(intptr_t)(rext.info->id);
switch (ext->cmd.type) {
case QXL_CMD_DRAW:
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ui/spice-display: check NULL pointer in interface_release_resource()
2021-05-20 10:58 [PATCH] ui/spice-display: check NULL pointer in interface_release_resource() Mauro Matteo Cascella
@ 2021-05-21 6:24 ` P J P
0 siblings, 0 replies; 2+ messages in thread
From: P J P @ 2021-05-21 6:24 UTC (permalink / raw)
To: Mauro Matteo Cascella; +Cc: ini.universe, qemu-devel, kraxel
+-- On Thu, 20 May 2021, Mauro Matteo Cascella wrote --+
| diff --git a/ui/spice-display.c b/ui/spice-display.c
| index d22781a23d..f59c69882d 100644
| --- a/ui/spice-display.c
| +++ b/ui/spice-display.c
| @@ -561,6 +561,10 @@ static void interface_release_resource(QXLInstance *sin,
| SimpleSpiceCursor *cursor;
| QXLCommandExt *ext;
|
| + if (!rext.info) {
| + return;
| + }
| +
| ext = (void *)(intptr_t)(rext.info->id);
| switch (ext->cmd.type) {
| case QXL_CMD_DRAW:
Looks okay.
Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org>
Thank you.
--
- P J P
8685 545E B54C 486B C6EB 271E E285 8B5A F050 DE8D
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-21 6:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 10:58 [PATCH] ui/spice-display: check NULL pointer in interface_release_resource() Mauro Matteo Cascella
2021-05-21 6:24 ` P J P
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).