[dpdk-dev] virtio: fix crash if VIRTIO_NET_F_CTRL_VQ is not negotiated

Message ID 1410474308-17744-1-git-send-email-damarion@cisco.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Damjan Marion (damarion) Sept. 11, 2014, 10:25 p.m. UTC
From: Damjan Marion <damarion@cisco.com>

If VIRTIO_NET_F_CTRL_VQ is not negotiated hw->cvq will be NULL

Signed-off-by: Damjan Marion <damarion@cisco.com>
---
 lib/librte_pmd_virtio/virtio_rxtx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Ouyang Changchun Sept. 12, 2014, 3:55 a.m. UTC | #1
Hi

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of
> damarion@cisco.com
> Sent: Friday, September 12, 2014 6:25 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] virtio: fix crash if VIRTIO_NET_F_CTRL_VQ is not
> negotiated
> 
> From: Damjan Marion <damarion@cisco.com>
> 
> If VIRTIO_NET_F_CTRL_VQ is not negotiated hw->cvq will be NULL
> 
> Signed-off-by: Damjan Marion <damarion@cisco.com>
> ---
>  lib/librte_pmd_virtio/virtio_rxtx.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c
> b/lib/librte_pmd_virtio/virtio_rxtx.c
> index 0b10108..8cb635e 100644
> --- a/lib/librte_pmd_virtio/virtio_rxtx.c
> +++ b/lib/librte_pmd_virtio/virtio_rxtx.c
> @@ -328,8 +328,10 @@ virtio_dev_cq_start(struct rte_eth_dev *dev)
>  	struct virtio_hw *hw
>  		= VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> 
> -	virtio_dev_vring_start(hw->cvq, VTNET_CQ);
> -	VIRTQUEUE_DUMP((struct virtqueue *)hw->cvq);
> +	if (hw->cvq) {
> +		virtio_dev_vring_start(hw->cvq, VTNET_CQ);
> +		VIRTQUEUE_DUMP((struct virtqueue *)hw->cvq);
> +	}
>  }
> 
>  void
> --
> 2.1.0

Acked-by: Changchun Ouyang <Changchun.ouyang@intel.com>
  
Olivier Matz Sept. 17, 2014, 7:32 a.m. UTC | #2
Hello,

On 09/12/2014 12:25 AM, damarion@cisco.com wrote:
> From: Damjan Marion <damarion@cisco.com>
>
> If VIRTIO_NET_F_CTRL_VQ is not negotiated hw->cvq will be NULL
>
> Signed-off-by: Damjan Marion <damarion@cisco.com>
> ---
>   lib/librte_pmd_virtio/virtio_rxtx.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>

Acked-by: Olivier Matz <olivier.matz@6wind.com>
  
Damjan Marion (damarion) Sept. 29, 2014, 6:09 p.m. UTC | #3
On 17 Sep 2014, at 09:32, Olivier MATZ <olivier.matz@6wind.com> wrote:

> Hello,
> 
> On 09/12/2014 12:25 AM, damarion@cisco.com wrote:
>> From: Damjan Marion <damarion@cisco.com>
>> 
>> If VIRTIO_NET_F_CTRL_VQ is not negotiated hw->cvq will be NULL
>> 
>> Signed-off-by: Damjan Marion <damarion@cisco.com>
>> ---
>>  lib/librte_pmd_virtio/virtio_rxtx.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>> 
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> 

Is this going to be applied or any action pending on my side?

Thanks,

Damjan
  
Thomas Monjalon Oct. 1, 2014, 9:51 a.m. UTC | #4
2014-09-29 18:09, Damjan Marion:
> On 17 Sep 2014, at 09:32, Olivier MATZ <olivier.matz@6wind.com> wrote:
> > On 09/12/2014 12:25 AM, damarion@cisco.com wrote:
> > > If VIRTIO_NET_F_CTRL_VQ is not negotiated hw->cvq will be NULL
> > > 
> > > Signed-off-by: Damjan Marion <damarion@cisco.com>
> > > ---
> > >  lib/librte_pmd_virtio/virtio_rxtx.c | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > Acked-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Is this going to be applied or any action pending on my side?

It's now applied.

Thanks
  

Patch

diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c
index 0b10108..8cb635e 100644
--- a/lib/librte_pmd_virtio/virtio_rxtx.c
+++ b/lib/librte_pmd_virtio/virtio_rxtx.c
@@ -328,8 +328,10 @@  virtio_dev_cq_start(struct rte_eth_dev *dev)
 	struct virtio_hw *hw
 		= VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	virtio_dev_vring_start(hw->cvq, VTNET_CQ);
-	VIRTQUEUE_DUMP((struct virtqueue *)hw->cvq);
+	if (hw->cvq) {
+		virtio_dev_vring_start(hw->cvq, VTNET_CQ);
+		VIRTQUEUE_DUMP((struct virtqueue *)hw->cvq);
+	}
 }
 
 void