From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>
Subject: [Qemu-devel] [PULL 05/16] hw/net/can: Fix segfaults when using the devices without bus
Date: Mon, 26 Mar 2018 15:36:32 +0200 [thread overview]
Message-ID: <1522071403-52486-6-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com>
From: Thomas Huth <thuth@redhat.com>
The CAN devices can currently be used to crash QEMU, e.g.:
$ x86_64-softmmu/qemu-system-x86_64 -device kvaser_pci
Segmentation fault (core dumped)
So we've got to add a proper check here that the corresponding
bus is available.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1521193892-15552-2-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/net/can/can_sja1000.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c
index 6293233..9a85038 100644
--- a/hw/net/can/can_sja1000.c
+++ b/hw/net/can/can_sja1000.c
@@ -866,6 +866,10 @@ int can_sja_connect_to_bus(CanSJA1000State *s, CanBusState *bus)
{
s->bus_client.info = &can_sja_bus_client_info;
+ if (!bus) {
+ return -EINVAL;
+ }
+
if (can_bus_insert_client(bus, &s->bus_client) < 0) {
return -1;
}
--
1.8.3.1
next prev parent reply other threads:[~2018-03-26 13:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 13:36 [Qemu-devel] [PULL 00/16] Misc fixes for QEMU 2.12.0-rc1 Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 01/16] scripts/get_maintainer.pl: Print proper error message for missing $file Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 02/16] WHPX fix WHvGetCapability out WrittenSizeInBytes Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 03/16] WHPX fix WHvSetPartitionProperty in PropertyCode Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 04/16] WHPX improve vcpu_post_run perf Paolo Bonzini
2018-03-26 13:36 ` Paolo Bonzini [this message]
2018-03-26 13:36 ` [Qemu-devel] [PULL 06/16] fdc: Exit if ISA controller does not support DMA Paolo Bonzini
2018-03-26 17:06 ` Thomas Huth
2018-03-26 17:10 ` Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 07/16] hw/audio: Fix crashes when devices are used on ISA bus without DMA Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 08/16] scripts/device-crash-test: Remove fixed isapc-with-iommu entry Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 09/16] vhost-user-test: do not hang if chardev creation failed Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 10/16] vhost-user-test: add back memfd check Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 11/16] tcg: Really fix cpu_io_recompile Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 12/16] chardev-socket: remove useless if Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 13/16] scsi: turn "is this a SCSI device?" into a conditional hint Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 14/16] iothread: fix breakage on windows Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 15/16] chardev/char-fe: Allow NULL chardev in qemu_chr_fe_init() Paolo Bonzini
2018-03-26 13:36 ` [Qemu-devel] [PULL 16/16] qemu-pr-helper: Actually allow users to specify pidfile Paolo Bonzini
2018-03-27 9:27 ` [Qemu-devel] [PULL 00/16] Misc fixes for QEMU 2.12.0-rc1 Peter Maydell
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=1522071403-52486-6-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@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 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).