patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v3 1/4] net/virtio: fix add pointer checking
       [not found] ` <20180321030343.64399-1-zhiyong.yang@intel.com>
@ 2018-03-21  3:03   ` zhiyong.yang
  2018-03-28  7:26     ` Tan, Jianfeng
                       ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: zhiyong.yang @ 2018-03-21  3:03 UTC (permalink / raw)
  To: dev
  Cc: jianfeng.tan, zhihong.wang, maxime.coquelin, thomas, dong1.wang,
	tiwei.bie, stable, Zhiyong Yang

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 <zhiyong.yang@intel.com>
---
 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) {
-- 
2.14.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [PATCH v3 1/4] net/virtio: fix add pointer checking
  2018-03-21  3:03   ` [dpdk-stable] [PATCH v3 1/4] net/virtio: fix add pointer checking zhiyong.yang
@ 2018-03-28  7:26     ` Tan, Jianfeng
  2018-03-28  7:48       ` Yang, Zhiyong
  2018-03-29 11:59     ` Maxime Coquelin
  2018-03-29 12:01     ` Maxime Coquelin
  2 siblings, 1 reply; 5+ messages in thread
From: Tan, Jianfeng @ 2018-03-28  7:26 UTC (permalink / raw)
  To: zhiyong.yang, dev
  Cc: zhihong.wang, maxime.coquelin, thomas, dong1.wang, tiwei.bie, stable



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 <zhiyong.yang@intel.com>

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 <jianfeng.tan@intel.com>

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) {

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [PATCH v3 1/4] net/virtio: fix add pointer checking
  2018-03-28  7:26     ` Tan, Jianfeng
@ 2018-03-28  7:48       ` Yang, Zhiyong
  0 siblings, 0 replies; 5+ messages in thread
From: Yang, Zhiyong @ 2018-03-28  7:48 UTC (permalink / raw)
  To: Tan, Jianfeng, dev
  Cc: Wang, Zhihong, maxime.coquelin, thomas, Wang, Dong1, Bie, Tiwei, stable



> -----Original Message-----
> From: Tan, Jianfeng
> Sent: Wednesday, March 28, 2018 3:26 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>; dev@dpdk.org
> Cc: Wang, Zhihong <zhihong.wang@intel.com>;
> maxime.coquelin@redhat.com; thomas@monjalon.net; Wang, Dong1
> <dong1.wang@intel.com>; Bie, Tiwei <tiwei.bie@intel.com>;
> stable@dpdk.org
> Subject: Re: [PATCH v3 1/4] net/virtio: fix add pointer checking
> 
> 
> 
> 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 <zhiyong.yang@intel.com>
> 
> 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 <jianfeng.tan@intel.com>
> 
> Thanks,
> Jianfeng
> 
Thanks for Jianfeng's review.  The bug must be fixed firstly in order 
that code can go in the right way  for virito-user server mode patch. :)

Thanks
Zhiyong

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [PATCH v3 1/4] net/virtio: fix add pointer checking
  2018-03-21  3:03   ` [dpdk-stable] [PATCH v3 1/4] net/virtio: fix add pointer checking zhiyong.yang
  2018-03-28  7:26     ` Tan, Jianfeng
@ 2018-03-29 11:59     ` Maxime Coquelin
  2018-03-29 12:01     ` Maxime Coquelin
  2 siblings, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2018-03-29 11:59 UTC (permalink / raw)
  To: zhiyong.yang, dev
  Cc: jianfeng.tan, zhihong.wang, thomas, dong1.wang, tiwei.bie, stable



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 <zhiyong.yang@intel.com>
> ---
>   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 <maxime.coquelin@redhat.com>

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [PATCH v3 1/4] net/virtio: fix add pointer checking
  2018-03-21  3:03   ` [dpdk-stable] [PATCH v3 1/4] net/virtio: fix add pointer checking zhiyong.yang
  2018-03-28  7:26     ` Tan, Jianfeng
  2018-03-29 11:59     ` Maxime Coquelin
@ 2018-03-29 12:01     ` Maxime Coquelin
  2 siblings, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2018-03-29 12:01 UTC (permalink / raw)
  To: zhiyong.yang, dev
  Cc: jianfeng.tan, zhihong.wang, thomas, dong1.wang, tiwei.bie, stable



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 <zhiyong.yang@intel.com>
> ---
>   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) {
> 

Applied to dpdk-next-virtio/master.

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-29 12:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20180214145330.4679-1-zhiyong.yang@intel.com>
     [not found] ` <20180321030343.64399-1-zhiyong.yang@intel.com>
2018-03-21  3:03   ` [dpdk-stable] [PATCH v3 1/4] net/virtio: fix add pointer checking zhiyong.yang
2018-03-28  7:26     ` Tan, Jianfeng
2018-03-28  7:48       ` Yang, Zhiyong
2018-03-29 11:59     ` Maxime Coquelin
2018-03-29 12:01     ` Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).