Commit bc68580d authored by Vasiliy Kulikov's avatar Vasiliy Kulikov Committed by David S. Miller

s390: use free_netdev(netdev) instead of kfree()

Freeing netdev without free_netdev() leads to net, tx leaks.
I might lead to dereferencing freed pointer.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

@@
struct net_device* dev;
@@

-kfree(dev)
+free_netdev(dev)
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8d879de8
...@@ -1154,7 +1154,7 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv) ...@@ -1154,7 +1154,7 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv)
dev_fsm, dev_fsm_len, GFP_KERNEL); dev_fsm, dev_fsm_len, GFP_KERNEL);
if (priv->fsm == NULL) { if (priv->fsm == NULL) {
CTCMY_DBF_DEV(SETUP, dev, "init_fsm error"); CTCMY_DBF_DEV(SETUP, dev, "init_fsm error");
kfree(dev); free_netdev(dev);
return NULL; return NULL;
} }
fsm_newstate(priv->fsm, DEV_STATE_STOPPED); fsm_newstate(priv->fsm, DEV_STATE_STOPPED);
...@@ -1165,7 +1165,7 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv) ...@@ -1165,7 +1165,7 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv)
grp = ctcmpc_init_mpc_group(priv); grp = ctcmpc_init_mpc_group(priv);
if (grp == NULL) { if (grp == NULL) {
MPC_DBF_DEV(SETUP, dev, "init_mpc_group error"); MPC_DBF_DEV(SETUP, dev, "init_mpc_group error");
kfree(dev); free_netdev(dev);
return NULL; return NULL;
} }
tasklet_init(&grp->mpc_tasklet2, tasklet_init(&grp->mpc_tasklet2,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment