From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH 1/2] virtio: fixed segmentation fault in queue_release Date: Tue, 20 Oct 2015 11:44:07 -0700 Message-ID: <20151020114407.58972ed5@xeon-e3> References: <1445355462-16521-1-git-send-email-bernard.iremonger@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: Bernard Iremonger Return-path: Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by dpdk.org (Postfix) with ESMTP id CDD1A5A57 for ; Tue, 20 Oct 2015 20:43:58 +0200 (CEST) Received: by pacfv9 with SMTP id fv9so29978592pac.3 for ; Tue, 20 Oct 2015 11:43:58 -0700 (PDT) In-Reply-To: <1445355462-16521-1-git-send-email-bernard.iremonger@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, 20 Oct 2015 16:37:41 +0100 Bernard Iremonger wrote: > if input parameter vq is NULL, hw = vq->hw, causes a segmentation fault. > > Signed-off-by: Bernard Iremonger > --- > drivers/net/virtio/virtio_ethdev.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index 465d3cd..147aca1 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -239,9 +239,10 @@ virtio_set_multiple_queues(struct rte_eth_dev *dev, uint16_t nb_queues) > > void > virtio_dev_queue_release(struct virtqueue *vq) { > - struct virtio_hw *hw = vq->hw; > + struct virtio_hw *hw; > > if (vq) { > + hw = vq->hw; > /* Select and deactivate the queue */ > VIRTIO_WRITE_REG_2(hw, VIRTIO_PCI_QUEUE_SEL, vq->queue_id); > VIRTIO_WRITE_REG_4(hw, VIRTIO_PCI_QUEUE_PFN, 0); This could only happen for the case of the control vq. Others are guaranteed to be non NULL by rte_ethdev. Acked-by: Stephen Hemminger