Skip to content

Commit

Permalink
net/virtio: fix dangling pointer on failure
Browse files Browse the repository at this point in the history
[ upstream commit 7dee8c7 ]

When eth_virtio_dev_init() is cleaning up, it does not correctly set
the mac_addrs variable to NULL, which will lead to a double free.

Found during unit-test fixes.

Fixes: 43d1876 ("net/virtio: fix memory leak on failure")

Reported-by: Michael Santana <msantana@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
  • Loading branch information
apconole authored and kevintraynor committed May 7, 2019
1 parent 467038a commit 9960f97
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/virtio/virtio_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)

out:
rte_free(eth_dev->data->mac_addrs);
eth_dev->data->mac_addrs = NULL;
return ret;
}

Expand Down

0 comments on commit 9960f97

Please sign in to comment.