qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] HMP: Initialize err before using
@ 2018-02-25  3:21 Zhangjixiang
  2018-02-26 20:03 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 5+ messages in thread
From: Zhangjixiang @ 2018-02-25  3:21 UTC (permalink / raw)
  To: qemu-devel@nongnu.org; +Cc: dgilbert@redhat.com

From 295640e6f4aa83b843e245bb1af9995be37de84d Mon Sep 17 00:00:00 2001
From: zhangjixiang <jixiang_zhang@h3c.com>
Date: Sun, 25 Feb 2018 09:47:51 +0800
Subject: [PATCH] HMP: Initialize err before using

When bdrv_snapshot_delete return fail, the errp will not be
assigned a valid value in error_propagate as errp didn't be
initialized in hmp_delvm, then error_reportf_err will use an
uninitialized value(call by hmp_delvm), and qemu crash.

Signed-off-by: zhangjixiang <jixiang_zhang@h3c.com>
---
hmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hmp.c b/hmp.c
index 7870d6a300..4a4da004e9 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1340,7 +1340,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict)
void hmp_delvm(Monitor *mon, const QDict *qdict)
{
     BlockDriverState *bs;
-    Error *err;
+    Error *err = NULL;
     const char *name = qdict_get_str(qdict, "name");
     if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {
--
2.11.0
-------------------------------------------------------------------------------------------------------------------------------------
本邮件及其附件含有新华三技术有限公司的保密信息,仅限于发送给上面地址中列出
的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、
或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本
邮件!
This e-mail and its attachments contain confidential information from New H3C, which is
intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
by phone or email immediately and delete it!

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] HMP: Initialize err before using
  2018-02-25  3:21 [Qemu-devel] [PATCH] HMP: Initialize err before using Zhangjixiang
@ 2018-02-26 20:03 ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 5+ messages in thread
From: Dr. David Alan Gilbert @ 2018-02-26 20:03 UTC (permalink / raw)
  To: Zhangjixiang; +Cc: qemu-devel@nongnu.org

* Zhangjixiang (jixiang_zhang@h3c.com) wrote:
> From 295640e6f4aa83b843e245bb1af9995be37de84d Mon Sep 17 00:00:00 2001
> From: zhangjixiang <jixiang_zhang@h3c.com>
> Date: Sun, 25 Feb 2018 09:47:51 +0800
> Subject: [PATCH] HMP: Initialize err before using
> 
> When bdrv_snapshot_delete return fail, the errp will not be
> assigned a valid value in error_propagate as errp didn't be
> initialized in hmp_delvm, then error_reportf_err will use an
> uninitialized value(call by hmp_delvm), and qemu crash.
> 
> Signed-off-by: zhangjixiang <jixiang_zhang@h3c.com>
> ---
> hmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hmp.c b/hmp.c
> index 7870d6a300..4a4da004e9 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1340,7 +1340,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict)
> void hmp_delvm(Monitor *mon, const QDict *qdict)
> {
>      BlockDriverState *bs;
> -    Error *err;
> +    Error *err = NULL;
>      const char *name = qdict_get_str(qdict, "name");
>      if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {

OK, that looks right; and that bug seems to have been around for a
while; thank you:

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

(I think the headers on the mail look a bit broken; it's probably best
to use git send-email  when possible).

Dave

> --
> 2.11.0
> -------------------------------------------------------------------------------------------------------------------------------------
> 本邮件及其附件含有新华三技术有限公司的保密信息,仅限于发送给上面地址中列出
> 的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、
> 或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本
> 邮件!
> This e-mail and its attachments contain confidential information from New H3C, which is
> intended only for the person or entity whose address is listed above. Any use of the
> information contained herein in any way (including, but not limited to, total or partial
> disclosure, reproduction, or dissemination) by persons other than the intended
> recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
> by phone or email immediately and delete it!
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH] HMP: Initialize err before using
@ 2018-03-07  7:02 Zhangjixiang
  2018-03-07  9:52 ` Dr. David Alan Gilbert
  2018-03-20 11:04 ` Dr. David Alan Gilbert
  0 siblings, 2 replies; 5+ messages in thread
From: Zhangjixiang @ 2018-03-07  7:02 UTC (permalink / raw)
  To: dgilbert@redhat.com; +Cc: qemu-devel@nongnu.org

When bdrv_snapshot_delete return fail, the errp will not be
assigned a valid value in error_propagate as errp didn't be
initialized in hmp_delvm, then error_reportf_err will use an
uninitialized value(call by hmp_delvm), and qemu crash.

Signed-off-by: zhangjixiang <jixiang_zhang@h3c.com>
---
hmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hmp.c b/hmp.c
index 7870d6a300..4a4da004e9 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1340,7 +1340,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict)
void hmp_delvm(Monitor *mon, const QDict *qdict)
{
     BlockDriverState *bs;
-    Error *err;
+    Error *err = NULL;
     const char *name = qdict_get_str(qdict, "name");
     if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {
--
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] HMP: Initialize err before using
  2018-03-07  7:02 Zhangjixiang
@ 2018-03-07  9:52 ` Dr. David Alan Gilbert
  2018-03-20 11:04 ` Dr. David Alan Gilbert
  1 sibling, 0 replies; 5+ messages in thread
From: Dr. David Alan Gilbert @ 2018-03-07  9:52 UTC (permalink / raw)
  To: Zhangjixiang; +Cc: qemu-devel@nongnu.org

* Zhangjixiang (jixiang_zhang@h3c.com) wrote:
> When bdrv_snapshot_delete return fail, the errp will not be
> assigned a valid value in error_propagate as errp didn't be
> initialized in hmp_delvm, then error_reportf_err will use an
> uninitialized value(call by hmp_delvm), and qemu crash.
> 
> Signed-off-by: zhangjixiang <jixiang_zhang@h3c.com>

Thanks; it's already noted to go in my next HMP pull.

(And this time the mail is the right format, thanks).

Dave

> ---
> hmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hmp.c b/hmp.c
> index 7870d6a300..4a4da004e9 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1340,7 +1340,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict)
> void hmp_delvm(Monitor *mon, const QDict *qdict)
> {
>      BlockDriverState *bs;
> -    Error *err;
> +    Error *err = NULL;
>      const char *name = qdict_get_str(qdict, "name");
>      if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {
> --
> 2.11.0
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] HMP: Initialize err before using
  2018-03-07  7:02 Zhangjixiang
  2018-03-07  9:52 ` Dr. David Alan Gilbert
@ 2018-03-20 11:04 ` Dr. David Alan Gilbert
  1 sibling, 0 replies; 5+ messages in thread
From: Dr. David Alan Gilbert @ 2018-03-20 11:04 UTC (permalink / raw)
  To: Zhangjixiang; +Cc: qemu-devel@nongnu.org

* Zhangjixiang (jixiang_zhang@h3c.com) wrote:
> When bdrv_snapshot_delete return fail, the errp will not be
> assigned a valid value in error_propagate as errp didn't be
> initialized in hmp_delvm, then error_reportf_err will use an
> uninitialized value(call by hmp_delvm), and qemu crash.
> 
> Signed-off-by: zhangjixiang <jixiang_zhang@h3c.com>

Queued.
Note, that even in this version something is corrupting the
patch; something has lost the space at the start of the line in the
first two lines of the patch; so something is still a bit odd in
your mail/patch generation.

Dave

> ---
> hmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hmp.c b/hmp.c
> index 7870d6a300..4a4da004e9 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1340,7 +1340,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict)
> void hmp_delvm(Monitor *mon, const QDict *qdict)
> {
>      BlockDriverState *bs;
> -    Error *err;
> +    Error *err = NULL;
>      const char *name = qdict_get_str(qdict, "name");
>      if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {
> --
> 2.11.0
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-20 11:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-25  3:21 [Qemu-devel] [PATCH] HMP: Initialize err before using Zhangjixiang
2018-02-26 20:03 ` Dr. David Alan Gilbert
  -- strict thread matches above, loose matches on Subject: below --
2018-03-07  7:02 Zhangjixiang
2018-03-07  9:52 ` Dr. David Alan Gilbert
2018-03-20 11:04 ` Dr. David Alan Gilbert

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).