net/af_packet: handle possible null pointer
authorChas Williams <ciwillia@brocade.com>
Wed, 17 May 2017 18:03:33 +0000 (14:03 -0400)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 12 Jun 2017 09:41:26 +0000 (10:41 +0100)
Fixes: 1b93c2aa81b4 ("net/af_packet: add interface name to internals")
Cc: stable@dpdk.org
Signed-off-by: Chas Williams <ciwillia@brocade.com>
drivers/net/af_packet/rte_eth_af_packet.c

index a03966a..ce4dc07 100644 (file)
@@ -630,6 +630,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
                goto error_early;
        }
        (*internals)->if_name = strdup(pair->value);
+       if ((*internals)->if_name == NULL)
+               goto error_early;
        (*internals)->if_index = ifr.ifr_ifindex;
 
        if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) == -1) {