mirror of https://gitee.com/openkylin/linux.git
staging: octeon: use free_netdev(netdev) instead of kfree()
It is not guaranteed that free_netdev() is macro. Freeing netdev without free_netdev() leads to net, tx leaks. I might lead to dereferencing freed pointer. Signed-off-by: Vasiliy Kulikov <segooon@gmail.com> Acked-by: David Daney <ddaney@caviumnetworks.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
8db3271cb2
commit
c4711c3acb
|
@ -670,7 +670,7 @@ static int __init cvm_oct_init_module(void)
|
||||||
|
|
||||||
if (register_netdev(dev) < 0) {
|
if (register_netdev(dev) < 0) {
|
||||||
pr_err("Failed to register ethernet device for POW\n");
|
pr_err("Failed to register ethernet device for POW\n");
|
||||||
kfree(dev);
|
free_netdev(dev);
|
||||||
} else {
|
} else {
|
||||||
cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
|
cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
|
||||||
pr_info("%s: POW send group %d, receive group %d\n",
|
pr_info("%s: POW send group %d, receive group %d\n",
|
||||||
|
@ -756,12 +756,12 @@ static int __init cvm_oct_init_module(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dev->netdev_ops) {
|
if (!dev->netdev_ops) {
|
||||||
kfree(dev);
|
free_netdev(dev);
|
||||||
} else if (register_netdev(dev) < 0) {
|
} else if (register_netdev(dev) < 0) {
|
||||||
pr_err("Failed to register ethernet device "
|
pr_err("Failed to register ethernet device "
|
||||||
"for interface %d, port %d\n",
|
"for interface %d, port %d\n",
|
||||||
interface, priv->port);
|
interface, priv->port);
|
||||||
kfree(dev);
|
free_netdev(dev);
|
||||||
} else {
|
} else {
|
||||||
cvm_oct_device[priv->port] = dev;
|
cvm_oct_device[priv->port] = dev;
|
||||||
fau -=
|
fau -=
|
||||||
|
@ -815,7 +815,7 @@ static void __exit cvm_oct_cleanup_module(void)
|
||||||
|
|
||||||
cvm_oct_tx_shutdown_dev(dev);
|
cvm_oct_tx_shutdown_dev(dev);
|
||||||
unregister_netdev(dev);
|
unregister_netdev(dev);
|
||||||
kfree(dev);
|
free_netdev(dev);
|
||||||
cvm_oct_device[port] = NULL;
|
cvm_oct_device[port] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue