* [Qemu-devel] [PATCH v2] ssh: Don't crash if either host or path is not specified.
@ 2014-09-29 8:06 Richard W.M. Jones
2014-09-29 8:30 ` Gonglei (Arei)
2014-09-29 10:20 ` Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: Richard W.M. Jones @ 2014-09-29 8:06 UTC (permalink / raw)
To: qemu-devel; +Cc: arei.gonglei
$ ./qemu-img create -f qcow2 overlay \
-b 'json: { "file.driver":"ssh",
"file.host":"localhost",
"file.host_key_check":"no" }'
qemu-img: qobject/qdict.c:193: qdict_get_obj: Assertion `obj != ((void *)0)' failed.
Aborted
A similar crash also happens if the file.host field is omitted.
https://bugzilla.redhat.com/show_bug.cgi?id=1147343
Bug found and reported by Jun Li.
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
block/ssh.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/block/ssh.c b/block/ssh.c
index cd2fd75..35f143d 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -517,6 +517,11 @@ static int connect_to_ssh(BDRVSSHState *s, QDict *options,
const char *host, *user, *path, *host_key_check;
int port;
+ if (!qdict_haskey(options, "host")) {
+ ret = -EINVAL;
+ error_setg(errp, "No hostname was specified");
+ goto err;
+ }
host = qdict_get_str(options, "host");
if (qdict_haskey(options, "port")) {
@@ -525,6 +530,11 @@ static int connect_to_ssh(BDRVSSHState *s, QDict *options,
port = 22;
}
+ if (!qdict_haskey(options, "path")) {
+ ret = -EINVAL;
+ error_setg(errp, "No path was specified");
+ goto err;
+ }
path = qdict_get_str(options, "path");
if (qdict_haskey(options, "user")) {
--
2.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] ssh: Don't crash if either host or path is not specified.
2014-09-29 8:06 [Qemu-devel] [PATCH v2] ssh: Don't crash if either host or path is not specified Richard W.M. Jones
@ 2014-09-29 8:30 ` Gonglei (Arei)
2014-09-29 10:20 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Gonglei (Arei) @ 2014-09-29 8:30 UTC (permalink / raw)
To: Richard W.M. Jones, qemu-devel; +Cc: Kevin Wolf, stefanha
> -----Original Message-----
> From: Richard W.M. Jones [mailto:rjones@redhat.com]
> Sent: Monday, September 29, 2014 4:06 PM
> To: qemu-devel@nongnu.org
> Cc: Gonglei (Arei)
> Subject: [PATCH v2] ssh: Don't crash if either host or path is not specified.
>
> $ ./qemu-img create -f qcow2 overlay \
> -b 'json: { "file.driver":"ssh",
> "file.host":"localhost",
> "file.host_key_check":"no" }'
> qemu-img: qobject/qdict.c:193: qdict_get_obj: Assertion `obj != ((void *)0)'
> failed.
> Aborted
>
> A similar crash also happens if the file.host field is omitted.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1147343
>
> Bug found and reported by Jun Li.
>
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> ---
> block/ssh.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
Cc'ing Stefan and Kevin.
You can add the change log between v1 and v2.
Anyway, looks good to me, so
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Best regards,
-Gonglei
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] ssh: Don't crash if either host or path is not specified.
2014-09-29 8:06 [Qemu-devel] [PATCH v2] ssh: Don't crash if either host or path is not specified Richard W.M. Jones
2014-09-29 8:30 ` Gonglei (Arei)
@ 2014-09-29 10:20 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-09-29 10:20 UTC (permalink / raw)
To: Richard W.M. Jones; +Cc: arei.gonglei, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 795 bytes --]
On Mon, Sep 29, 2014 at 09:06:22AM +0100, Richard W.M. Jones wrote:
> $ ./qemu-img create -f qcow2 overlay \
> -b 'json: { "file.driver":"ssh",
> "file.host":"localhost",
> "file.host_key_check":"no" }'
> qemu-img: qobject/qdict.c:193: qdict_get_obj: Assertion `obj != ((void *)0)' failed.
> Aborted
>
> A similar crash also happens if the file.host field is omitted.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1147343
>
> Bug found and reported by Jun Li.
>
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> ---
> block/ssh.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
Please CC Kevin Wolf and me on block patches.
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-29 10:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-29 8:06 [Qemu-devel] [PATCH v2] ssh: Don't crash if either host or path is not specified Richard W.M. Jones
2014-09-29 8:30 ` Gonglei (Arei)
2014-09-29 10:20 ` Stefan Hajnoczi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.