net/enic: fix possible null pointer dereference
authorRongQiang Xie <xie.rongqiang@zte.com.cn>
Wed, 23 Aug 2017 08:49:24 +0000 (16:49 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 6 Oct 2017 00:49:47 +0000 (02:49 +0200)
In enic_alloc_consistent() function, if rte_malloc for mze is failed,
!mze is true, memzone should be freed and function should return NULL.

Fixes: da5f560be966 ("net/enic: fix memory freeing")
Cc: stable@dpdk.org
Signed-off-by: RongQiang Xie <xie.rongqiang@zte.com.cn>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/enic/enic_main.c

index 40dbec7..1d956cd 100644 (file)
@@ -368,6 +368,7 @@ enic_alloc_consistent(void *priv, size_t size,
                pr_err("%s : Failed to allocate memory for memzone list\n",
                       __func__);
                rte_memzone_free(rz);
+               return NULL;
        }
 
        mze->rz = rz;