From: Vikram Garhwal <fnu.vikram@xilinx.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
qemu-devel@nongnu.org,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Pavel Pisa" <pisa@cmp.felk.cvut.cz>
Subject: Re: [PATCH 2/3] can-host-socketcan: Fix crash when 'if' option is not set
Date: Mon, 12 Oct 2020 09:23:13 -0700 [thread overview]
Message-ID: <20201012162312.GA159389@xilinx.com> (raw)
In-Reply-To: <20201008202713.1416823-3-ehabkost@redhat.com>
On Thu, Oct 08, 2020 at 04:27:12PM -0400, Eduardo Habkost wrote:
> Fix the following crash:
>
> $ qemu-system-x86_64 -object can-host-socketcan,id=obj0
> Segmentation fault (core dumped)
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Vikram Garhwal <fnu.vikram@xilinx.com>
> ---
> Cc: Pavel Pisa <pisa@cmp.felk.cvut.cz>
> Cc: Vikram Garhwal <fnu.vikram@xilinx.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
> net/can/can_socketcan.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/net/can/can_socketcan.c b/net/can/can_socketcan.c
> index 92b1f79385..4b68f60c6b 100644
> --- a/net/can/can_socketcan.c
> +++ b/net/can/can_socketcan.c
> @@ -194,6 +194,11 @@ static void can_host_socketcan_connect(CanHostState *ch, Error **errp)
> struct sockaddr_can addr;
> struct ifreq ifr;
>
> + if (!c->ifname) {
> + error_setg(errp, "'if' property not set");
> + return;
> + }
> +
> /* open socket */
> s = qemu_socket(PF_CAN, SOCK_RAW, CAN_RAW);
> if (s < 0) {
> --
> 2.26.2
>
next prev parent reply other threads:[~2020-10-12 16:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-08 20:27 [PATCH 0/3] Fix some crashes when using -object Eduardo Habkost
2020-10-08 20:27 ` [PATCH 1/3] authz-list-file: Fix crash when filename is not set Eduardo Habkost
2020-10-08 21:17 ` Cleber Rosa
2020-10-09 8:37 ` Daniel P. Berrangé
2020-10-09 10:31 ` Philippe Mathieu-Daudé
2020-10-09 15:06 ` Li Qiang
2020-10-08 20:27 ` [PATCH 2/3] can-host-socketcan: Fix crash when 'if' option " Eduardo Habkost
2020-10-08 22:18 ` Pavel Pisa
2020-10-09 15:17 ` Li Qiang
2020-10-12 16:23 ` Vikram Garhwal [this message]
2020-10-08 20:27 ` [PATCH 3/3] tests/acceptance: Test case for detecting -object crashes Eduardo Habkost
2020-10-09 0:48 ` Cleber Rosa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201012162312.GA159389@xilinx.com \
--to=fnu.vikram@xilinx.com \
--cc=berrange@redhat.com \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=jasowang@redhat.com \
--cc=philmd@redhat.com \
--cc=pisa@cmp.felk.cvut.cz \
--cc=qemu-devel@nongnu.org \
--cc=wainersm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.