From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id 7BDB82BC7; Thu, 29 Mar 2018 13:59:05 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7842880AD238; Thu, 29 Mar 2018 11:59:04 +0000 (UTC) Received: from [10.36.112.54] (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C37932026980; Thu, 29 Mar 2018 11:59:02 +0000 (UTC) To: zhiyong.yang@intel.com, dev@dpdk.org Cc: jianfeng.tan@intel.com, zhihong.wang@intel.com, thomas@monjalon.net, dong1.wang@intel.com, tiwei.bie@intel.com, stable@dpdk.org References: <20180214145330.4679-1-zhiyong.yang@intel.com> <20180321030343.64399-1-zhiyong.yang@intel.com> <20180321030343.64399-2-zhiyong.yang@intel.com> From: Maxime Coquelin Message-ID: <411bcebd-28c7-bd47-9aa6-1b600bb4262c@redhat.com> Date: Thu, 29 Mar 2018 13:59:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180321030343.64399-2-zhiyong.yang@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 29 Mar 2018 11:59:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 29 Mar 2018 11:59:04 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:'' Subject: Re: [dpdk-dev] [PATCH v3 1/4] net/virtio: fix add pointer checking X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Mar 2018 11:59:05 -0000 On 03/21/2018 04:03 AM, zhiyong.yang@intel.com wrote: > It is necessary to add pointer checking because in some case the > code will cause crash. For example, the code goes here before > memory allocation of rxvq is finished. > > Fixes: 7365504f77e3("net/virtio: support guest announce") > Cc: stable@dpdk.org > Signed-off-by: Zhiyong Yang > --- > drivers/net/virtio/virtio_ethdev.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index 884f74ad0..f377d8aa3 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -1273,9 +1273,13 @@ static void > virtio_notify_peers(struct rte_eth_dev *dev) > { > struct virtio_hw *hw = dev->data->dev_private; > - struct virtnet_rx *rxvq = dev->data->rx_queues[0]; > + struct virtnet_rx *rxvq; > struct rte_mbuf *rarp_mbuf; > > + if (!dev->data->rx_queues) > + return; > + > + rxvq = dev->data->rx_queues[0]; > rarp_mbuf = rte_net_make_rarp_packet(rxvq->mpool, > (struct ether_addr *)hw->mac_addr); > if (rarp_mbuf == NULL) { > Reviewed-by: Maxime Coquelin Thanks, Maxime