From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhGWR-0004eV-9l for qemu-devel@nongnu.org; Sun, 12 Apr 2015 07:57:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YhGWN-0005db-2x for qemu-devel@nongnu.org; Sun, 12 Apr 2015 07:57:55 -0400 Received: from cantor2.suse.de ([195.135.220.15]:59191 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhGWM-0005dV-T1 for qemu-devel@nongnu.org; Sun, 12 Apr 2015 07:57:51 -0400 Message-ID: <552A5DBC.7070903@suse.de> Date: Sun, 12 Apr 2015 13:57:48 +0200 From: =?windows-1252?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1428586365-17909-1-git-send-email-thuth@redhat.com> <20150409153536-mutt-send-email-mst@redhat.com> <20150412131338-mutt-send-email-mst@redhat.com> In-Reply-To: <20150412131338-mutt-send-email-mst@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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: Peter Maydell , Thomas Huth , Jason Wang , Stefan Hajnoczi , QEMU Developers Am 12.04.2015 um 13:14 schrieb Michael S. Tsirkin: > On Thu, Apr 09, 2015 at 03:48:57PM +0100, Peter Maydell wrote: >> 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=3Dxxx" option, e.g.: >>>> >>>> $ qemu-system-x86_64 -net nic,model=3Dn/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=3D0x0) at util/error.c:1= 52 >>>> 152 return err->msg; >>>> (gdb) bt >>>> 0 0x0000555555965fe0 in error_get_pretty (err=3D0x0) at util/error= .c:152 >>>> 1 0x0000555555965ffd in error_report_err (err=3D0x0) at util/error= .c:157 >>>> 2 0x0000555555809c90 in pci_nic_init_nofail (nd=3D0x555555e49860 <= nd_table>, rootbus=3D0x5555564409b0, >>>> default_model=3D0x55555598c37b "e1000", default_devaddr=3D0x0) a= t hw/pci/pci.c:1663 >>>> 3 0x0000555555691e42 in pc_nic_init (isa_bus=3D0x555556f71900, pci= _bus=3D0x5555564409b0) >>>> at hw/i386/pc.c:1506 >>>> 4 0x000055555569396b in pc_init1 (machine=3D0x5555562abbf0, pci_en= abled=3D1, kvmclock_enabled=3D1) >>>> at hw/i386/pc_piix.c:248 >>>> 5 0x0000555555693d27 in pc_init_pci (machine=3D0x5555562abbf0) at = hw/i386/pc_piix.c:310 >>>> 6 0x000055555572ddf5 in main (argc=3D3, argv=3D0x7fffffffe018, env= p=3D0x7fffffffe038) 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 p= ointer >>>> to error_report_err(). Fix it by correctly checking the err paramete= r. >>>> >>>> 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? >=20 > I reviewed the patch, and sent a tag. > I'm fine with you making the decision on whether it's > appropriate for 2.3. Hope you added a "pci:" topic? :) Andreas --=20 SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Felix Imend=F6rffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu, Graham Norton; HRB 21284 (AG N=FCrnberg)