Skip to content

Commit

Permalink
s390: use free_netdev(netdev) instead of kfree()
Browse files Browse the repository at this point in the history
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: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vasiliy Kulikov authored and David S. Miller committed Sep 27, 2010
1 parent 8d879de commit bc68580
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/s390/net/ctcm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv)
dev_fsm, dev_fsm_len, GFP_KERNEL);
if (priv->fsm == NULL) {
CTCMY_DBF_DEV(SETUP, dev, "init_fsm error");
kfree(dev);
free_netdev(dev);
return NULL;
}
fsm_newstate(priv->fsm, DEV_STATE_STOPPED);
Expand All @@ -1165,7 +1165,7 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv)
grp = ctcmpc_init_mpc_group(priv);
if (grp == NULL) {
MPC_DBF_DEV(SETUP, dev, "init_mpc_group error");
kfree(dev);
free_netdev(dev);
return NULL;
}
tasklet_init(&grp->mpc_tasklet2,
Expand Down

0 comments on commit bc68580

Please sign in to comment.