From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 517A3255; Wed, 28 Mar 2018 09:26:18 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2018 00:26:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,370,1517904000"; d="scan'208";a="29518031" Received: from tanjianf-mobl.ccr.corp.intel.com (HELO [10.67.64.59]) ([10.67.64.59]) by orsmga006.jf.intel.com with ESMTP; 28 Mar 2018 00:26:14 -0700 To: zhiyong.yang@intel.com, dev@dpdk.org References: <20180214145330.4679-1-zhiyong.yang@intel.com> <20180321030343.64399-1-zhiyong.yang@intel.com> <20180321030343.64399-2-zhiyong.yang@intel.com> Cc: zhihong.wang@intel.com, maxime.coquelin@redhat.com, thomas@monjalon.net, dong1.wang@intel.com, tiwei.bie@intel.com, stable@dpdk.org From: "Tan, Jianfeng" Message-ID: <7f1021a3-b625-687d-ca13-9a289be8a1f3@intel.com> Date: Wed, 28 Mar 2018 15:26:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20180321030343.64399-2-zhiyong.yang@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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: Wed, 28 Mar 2018 07:26:18 -0000 On 3/21/2018 11: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 This fix is not related to the topic of this patch series, correct? Maybe next time, we can put it out of the patch series. Reviewed-by: Jianfeng Tan Thanks, Jianfeng > --- > 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) {