qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: John Snow <jsnow@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>,
	Alexey Kardashevskiy <aik@ozlabs.ru>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Pavel Pisa <pisa@cmp.felk.cvut.cz>,
	Jason Wang <jasowang@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH 1/4] hw/net/can: Fix segfaults when using the devices without bus
Date: Fri, 16 Mar 2018 10:51:29 +0100	[thread overview]
Message-ID: <1521193892-15552-2-git-send-email-thuth@redhat.com> (raw)
In-Reply-To: <1521193892-15552-1-git-send-email-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>
---
 hw/net/can/can_sja1000.c  | 4 ++++
 scripts/device-crash-test | 3 ---
 2 files changed, 4 insertions(+), 3 deletions(-)

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;
     }
diff --git a/scripts/device-crash-test b/scripts/device-crash-test
index f04f349..7ff351d 100755
--- a/scripts/device-crash-test
+++ b/scripts/device-crash-test
@@ -223,9 +223,6 @@ ERROR_WHITELIST = [
     {'exitcode':-11, 'device':'sb16', 'loglevel':logging.ERROR, 'expected':True},
     {'exitcode':-11, 'device':'cs4231a', 'loglevel':logging.ERROR, 'expected':True},
     {'exitcode':-11, 'machine':'isapc', 'device':'.*-iommu', 'loglevel':logging.ERROR, 'expected':True},
-    {'exitcode':-11, 'device':'mioe3680_pci', 'loglevel':logging.ERROR, 'expected':True},
-    {'exitcode':-11, 'device':'pcm3680_pci', 'loglevel':logging.ERROR, 'expected':True},
-    {'exitcode':-11, 'device':'kvaser_pci', 'loglevel':logging.ERROR, 'expected':True},
 
     # everything else (including SIGABRT and SIGSEGV) will be a fatal error:
     {'exitcode':None, 'fatal':True, 'loglevel':logging.FATAL},
-- 
1.8.3.1

  reply	other threads:[~2018-03-16  9:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16  9:51 [Qemu-devel] [PATCH for-2.12 0/4] Fix crashes with CAN bus and ISA DMA devices Thomas Huth
2018-03-16  9:51 ` Thomas Huth [this message]
2018-03-16  9:51 ` [Qemu-devel] [PATCH 2/4] fdc: Exit if ISA controller does not support DMA Thomas Huth
2018-03-16  9:51 ` [Qemu-devel] [PATCH 3/4] hw/audio: Fix crashes when devices are used on ISA bus without DMA Thomas Huth
2018-03-16 12:32   ` Philippe Mathieu-Daudé
2018-03-16  9:51 ` [Qemu-devel] [PATCH 4/4] scripts/device-crash-test: Remove fixed isapc-with-iommu entry Thomas Huth
2018-03-16 10:15 ` [Qemu-devel] [PATCH for-2.12 0/4] Fix crashes with CAN bus and ISA DMA devices Paolo Bonzini
2018-03-23 18:20   ` John Snow
2018-03-26  7:38     ` Paolo Bonzini

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=1521193892-15552-2-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=ehabkost@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pisa@cmp.felk.cvut.cz \
    --cc=qemu-devel@nongnu.org \
    /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).