diff mbox

[ovs-dev] netdev-dpdk: Fix crash in QoS.

Message ID 20161101015714.24368-1-diproiettod@vmware.com
State Accepted
Headers show

Commit Message

Daniele Di Proietto Nov. 1, 2016, 1:57 a.m. UTC
qos_conf can be NULL.  This can be easily reproduced by setting egress
QoS on a port:

```
ovs-vsctl set port dpdk2 qos=@newqos -- --id=@newqos create qos
type=egress-policer other-config:cir=46000000 other-config:cbs=2048
```

Reported-by: Ian Stokes <ian.stokes@intel.com>
Fixes: 78bd47cf44a5 ("netdev-dpdk: Use RCU for egress QoS.")
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
---
 lib/netdev-dpdk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stokes, Ian Nov. 2, 2016, 5:59 p.m. UTC | #1
> qos_conf can be NULL.  This can be easily reproduced by setting egress QoS
> on a port:
> 
> ```
> ovs-vsctl set port dpdk2 qos=@newqos -- --id=@newqos create qos
> type=egress-policer other-config:cir=46000000 other-config:cbs=2048 ```
> 
> Reported-by: Ian Stokes <ian.stokes@intel.com>
> Fixes: 78bd47cf44a5 ("netdev-dpdk: Use RCU for egress QoS.")
> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
> ---
>  lib/netdev-dpdk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 7c1523e..49750c3
> 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -2803,7 +2803,7 @@ netdev_dpdk_set_qos(struct netdev *netdev, const
> char *type,
>          if (type && type[0]) {
>              error = EOPNOTSUPP;
>          }
> -    } else if (qos_conf->ops == new_ops
> +    } else if (qos_conf && qos_conf->ops == new_ops
>                 && qos_conf->ops->qos_is_equal(qos_conf, details)) {
>          new_qos_conf = qos_conf;
>      } else {
> --
> 2.9.3

Thanks for this Daniele.

Tested-by: Ian Stokes <ian.stokes@intel.com>
Acked-by: Ian Stokes <ian.stokes@intel.com>
Daniele Di Proietto Nov. 15, 2016, 2:37 a.m. UTC | #2
2016-11-02 10:59 GMT-07:00 Stokes, Ian <ian.stokes@intel.com>:

> > qos_conf can be NULL.  This can be easily reproduced by setting egress
> QoS
> > on a port:
> >
> > ```
> > ovs-vsctl set port dpdk2 qos=@newqos -- --id=@newqos create qos
> > type=egress-policer other-config:cir=46000000 other-config:cbs=2048 ```
> >
> > Reported-by: Ian Stokes <ian.stokes@intel.com>
> > Fixes: 78bd47cf44a5 ("netdev-dpdk: Use RCU for egress QoS.")
> > Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
> > ---
> >  lib/netdev-dpdk.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 7c1523e..49750c3
> > 100644
> > --- a/lib/netdev-dpdk.c
> > +++ b/lib/netdev-dpdk.c
> > @@ -2803,7 +2803,7 @@ netdev_dpdk_set_qos(struct netdev *netdev, const
> > char *type,
> >          if (type && type[0]) {
> >              error = EOPNOTSUPP;
> >          }
> > -    } else if (qos_conf->ops == new_ops
> > +    } else if (qos_conf && qos_conf->ops == new_ops
> >                 && qos_conf->ops->qos_is_equal(qos_conf, details)) {
> >          new_qos_conf = qos_conf;
> >      } else {
> > --
> > 2.9.3
>
> Thanks for this Daniele.
>
> Tested-by: Ian Stokes <ian.stokes@intel.com>
> Acked-by: Ian Stokes <ian.stokes@intel.com>
>
>
>
Sorry for the breakage and thanks  for reporting Ian,

I pushed this to master
diff mbox

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 7c1523e..49750c3 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2803,7 +2803,7 @@  netdev_dpdk_set_qos(struct netdev *netdev, const char *type,
         if (type && type[0]) {
             error = EOPNOTSUPP;
         }
-    } else if (qos_conf->ops == new_ops
+    } else if (qos_conf && qos_conf->ops == new_ops
                && qos_conf->ops->qos_is_equal(qos_conf, details)) {
         new_qos_conf = qos_conf;
     } else {