From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkeXk-0001kL-It for qemu-devel@nongnu.org; Mon, 17 Dec 2012 12:31:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkeXj-0000tU-KK for qemu-devel@nongnu.org; Mon, 17 Dec 2012 12:31:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19623) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkeXj-0000tP-DQ for qemu-devel@nongnu.org; Mon, 17 Dec 2012 12:31:55 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBHHVsRx027720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Dec 2012 12:31:54 -0500 Date: Mon, 17 Dec 2012 23:01:46 +0530 From: Amit Shah Message-ID: <20121217173146.GG21639@amit.redhat.com> References: <93bab39d85368c53633059501e58dc726d50c457.1355396592.git.amit.shah@redhat.com> <87sj74stw6.fsf@blackfin.pond.sub.org> <20121217163429.GE21639@amit.redhat.com> <876240lhhy.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <876240lhhy.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH 1/1] virtio-serial-bus: send_control_msg should not deal with cpkts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu list On (Mon) 17 Dec 2012 [18:23:53], Markus Armbruster wrote: > >> However, it now worries find_port_by_id() in remove_port() could return > >> a null pointer, which is then dereferenced. No idea why it didn't > >> report that before. Obvious suppressor: > >> > >> diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c > >> index 47d0481..7ff7505 100644 > >> --- a/hw/virtio-serial-bus.c > >> +++ b/hw/virtio-serial-bus.c > >> @@ -826,6 +826,7 @@ static void remove_port(VirtIOSerial *vser, uint32_t port_id) > >> vser->ports_map[i] &= ~(1U << (port_id % 32)); > >> > >> port = find_port_by_id(vser, port_id); > >> + assert(port); > >> /* Flush out any unconsumed buffers first */ > >> discard_vq_data(port->ovq, &port->vser->vdev); > > > > remove_port() is called by the hot-unplug qdev callback, and if the > > port's missing from our tailq, something's gone wrong anyway. So this > > patch makes sense too. > > Will you take care of that, or do you want me to post the patch? I was going to, but if you want to, go ahead -- you already have the patch ready :) Amit