> On Tue, Feb 28, 2017 at 03:21:07PM +0000, Ian Stokes wrote:
> > The dpdk_mp_get() function can return a NULL pointer which leads to a
> > segfault when a mempool cannot be created. The lack of a return value
> > check for the function netdev_dpdk_mempool_configure() when called in
> > netdev_dpdk_reconfigure() can result in a segfault also as a NULL
> > pointer for the mempool will be passed to rte_eth_rx_queue_setup().
> >
> > Fix this by adding appropriate NULL pointer and return value checks to
> > dpdk_mp_get(), netdev_dpdk_reconfigure() and
> dpdk_vhost_reconfigure_helper().
> >
> > Signed-off-by: Ian Stokes <[email protected]>
> > Fixes: 2ae3d542 ("netdev-dpdk: Refactor dpdk_mp_get().")
> > Fixes: 0072e931 ("netdev-dpdk: add support for jumbo frames")
> > CC: Daniele Di Proietto <[email protected]>
> > CC: Mark Kavanagh <[email protected]>
> >
> > ---
> > v2
> > * Remove extra VLOG_ERR in netdev_dpdk_reconfigure()
> > * Remove extra VLOG_ERR in netdev_vhost_reconfigure_helper()
> > * Remove check for NULL mempool in netdev_vhost_reconfigure_helper() as
> > netdev_dpdk_mempool_configure() already checks and returns ENOMEM
> error
> > for this case.
> >
> > v1
> > * Add NULL pointer check to dpdk_mp_get() when calling dpdk_mp_create().
> > * Add return type check when calling netdev_dpdk_mempool_configure() in
> > netdev_dpdk_reconfigure().
> > * Add return type check when calling netdev_dpdk_mempool_configure() in
> > netdev_vhost_reconfigure_helper()
> > ---
> > ---
> > lib/netdev-dpdk.c | 19 +++++++++++--------
> > 1 files changed, 11 insertions(+), 8 deletions(-)
> >
> > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index
> > ee53c4c..b881893 100644
> > --- a/lib/netdev-dpdk.c
> > +++ b/lib/netdev-dpdk.c
> > @@ -529,8 +529,9 @@ dpdk_mp_get(int socket_id, int mtu)
> > }
> > }
> >
> > - dmp = dpdk_mp_create(socket_id, mtu);
> > - ovs_list_push_back(&dpdk_mp_list, &dmp->list_node);
>
> The OVS coding style discourages assignments within "if" conditions:
Thanks for the catch Ben, I've fixed this in the v3 submitted today.
>
> > + if ((dmp = dpdk_mp_create(socket_id, mtu))) {
> > + ovs_list_push_back(&dpdk_mp_list, &dmp->list_node);
> > + }
>
> I didn't review the correctness of the change.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev