From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgDlj-0007jI-1c for qemu-devel@nongnu.org; Thu, 09 Apr 2015 10:49:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgDle-0002Vf-80 for qemu-devel@nongnu.org; Thu, 09 Apr 2015 10:49:23 -0400 Received: from mail-ie0-f181.google.com ([209.85.223.181]:35993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgDle-0002VZ-45 for qemu-devel@nongnu.org; Thu, 09 Apr 2015 10:49:18 -0400 Received: by iebrs15 with SMTP id rs15so102582616ieb.3 for ; Thu, 09 Apr 2015 07:49:17 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20150409153536-mutt-send-email-mst@redhat.com> References: <1428586365-17909-1-git-send-email-thuth@redhat.com> <20150409153536-mutt-send-email-mst@redhat.com> From: Peter Maydell Date: Thu, 9 Apr 2015 15:48:57 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH] Fix crash with illegal "-net nic, model=xxx" option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Thomas Huth , Jason Wang , Stefan Hajnoczi , QEMU Developers On 9 April 2015 at 14:37, Michael S. Tsirkin wrote: > On Thu, Apr 09, 2015 at 03:32:45PM +0200, Thomas Huth wrote: >> Current QEMU crashes when specifying an illegal model with the >> "-net nic,model=xxx" option, e.g.: >> >> $ qemu-system-x86_64 -net nic,model=n/a >> qemu-system-x86_64: Unsupported NIC model: n/a >> >> Program received signal SIGSEGV, Segmentation fault. >> >> The gdb backtrace looks like this: >> >> 0x0000555555965fe0 in error_get_pretty (err=0x0) at util/error.c:152 >> 152 return err->msg; >> (gdb) bt >> 0 0x0000555555965fe0 in error_get_pretty (err=0x0) at util/error.c:152 >> 1 0x0000555555965ffd in error_report_err (err=0x0) at util/error.c:157 >> 2 0x0000555555809c90 in pci_nic_init_nofail (nd=0x555555e49860 , rootbus=0x5555564409b0, >> default_model=0x55555598c37b "e1000", default_devaddr=0x0) at hw/pci/pci.c:1663 >> 3 0x0000555555691e42 in pc_nic_init (isa_bus=0x555556f71900, pci_bus=0x5555564409b0) >> at hw/i386/pc.c:1506 >> 4 0x000055555569396b in pc_init1 (machine=0x5555562abbf0, pci_enabled=1, kvmclock_enabled=1) >> at hw/i386/pc_piix.c:248 >> 5 0x0000555555693d27 in pc_init_pci (machine=0x5555562abbf0) at hw/i386/pc_piix.c:310 >> 6 0x000055555572ddf5 in main (argc=3, argv=0x7fffffffe018, envp=0x7fffffffe038) at vl.c:4226 >> >> The problem is that pci_nic_init_nofail() does not check whether the err >> parameter from pci_nic_init has been set up and thus passes a NULL pointer >> to error_report_err(). Fix it by correctly checking the err parameter. >> >> Signed-off-by: Thomas Huth > > Thanks! > Given that this is a legacy -net option, I'm inclined > to fix it post-2.3, and Cc stable. > Unfortunately I won't be able to do a pull request before rc3. Since this is a pretty safe and simple change I'm happy to apply it direct to master if you like. Do you want to provide a reviewed-by tag? thanks -- PMM