diff options
author | Aleksey Makarov <aleksey.makarov@cavium.com> | 2017-11-09 14:58:57 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-11-11 13:22:34 +0300 |
commit | 3d67a5075295982fb055be6a5d5c78b0e0be3591 (patch) | |
tree | e7e3d3d84d5eec74682d804ed3e0adb881aa5bf4 /drivers/net/ipvlan | |
parent | 86dabda426ac33f4782854ef71f0c9adafd24134 (diff) | |
download | linux-3d67a5075295982fb055be6a5d5c78b0e0be3591.tar.xz |
net: thunderx: fix double free error
This patch fixes an error in memory allocation/freeing in
ThunderX PF driver.
I moved the allocation to the probe() function and made it managed.
>From the Colin's email:
While running static analysis on linux-next with CoverityScan I found 3
double free errors in the Cavium thunder driver.
The issue occurs on the err_disable_device: label of function nic_probe
when nic_free_lmacmem(nic) is called and a double free occurs on
nic->duplex, nic->link and nic->speed. This occurs when nic_init_hw()
fails:
/* Initialize hardware */
err = nic_init_hw(nic);
if (err)
goto err_release_regions;
nic_init_hw() calls nic_get_hw_info() and this calls nic_free_lmacmem()
if any of the allocations fail. This free'ing occurs again by the call
to nic_free_lmacmem() on the err_release_regions exit path in nic_probe().
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ipvlan')
0 files changed, 0 insertions, 0 deletions