diff options
author | Alan Ott <alan@signal11.us> | 2012-11-29 13:25:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-30 12:19:24 -0500 |
commit | fcefbe9fcb3b0d72c91629f7fcf7ea09a46ab2c1 (patch) | |
tree | 7b68000fe15086df2037cf4dbb89242b77257a7f /net/mac802154 | |
parent | b333b7e6ec210412be49d1dc67b62d4e565a0cd6 (diff) |
mac802154: fix memory leaks
kfree_skb() was not getting called in the case of some failures.
This was pointed out by Eric Dumazet.
Signed-off-by: Alan Ott <alan@signal11.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac802154')
-rw-r--r-- | net/mac802154/tx.c | 5 | ||||
-rw-r--r-- | net/mac802154/wpan.c | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c index 1a4df39c722e..db639140afc6 100644 --- a/net/mac802154/tx.c +++ b/net/mac802154/tx.c | |||
@@ -85,6 +85,7 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb, | |||
85 | 85 | ||
86 | if (!(priv->phy->channels_supported[page] & (1 << chan))) { | 86 | if (!(priv->phy->channels_supported[page] & (1 << chan))) { |
87 | WARN_ON(1); | 87 | WARN_ON(1); |
88 | kfree_skb(skb); | ||
88 | return NETDEV_TX_OK; | 89 | return NETDEV_TX_OK; |
89 | } | 90 | } |
90 | 91 | ||
@@ -103,8 +104,10 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb, | |||
103 | } | 104 | } |
104 | 105 | ||
105 | work = kzalloc(sizeof(struct xmit_work), GFP_ATOMIC); | 106 | work = kzalloc(sizeof(struct xmit_work), GFP_ATOMIC); |
106 | if (!work) | 107 | if (!work) { |
108 | kfree_skb(skb); | ||
107 | return NETDEV_TX_BUSY; | 109 | return NETDEV_TX_BUSY; |
110 | } | ||
108 | 111 | ||
109 | INIT_WORK(&work->work, mac802154_xmit_worker); | 112 | INIT_WORK(&work->work, mac802154_xmit_worker); |
110 | work->skb = skb; | 113 | work->skb = skb; |
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c index f30f6d4beea1..1191039c2b1b 100644 --- a/net/mac802154/wpan.c +++ b/net/mac802154/wpan.c | |||
@@ -327,8 +327,10 @@ mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev) | |||
327 | 327 | ||
328 | if (chan == MAC802154_CHAN_NONE || | 328 | if (chan == MAC802154_CHAN_NONE || |
329 | page >= WPAN_NUM_PAGES || | 329 | page >= WPAN_NUM_PAGES || |
330 | chan >= WPAN_NUM_CHANNELS) | 330 | chan >= WPAN_NUM_CHANNELS) { |
331 | kfree_skb(skb); | ||
331 | return NETDEV_TX_OK; | 332 | return NETDEV_TX_OK; |
333 | } | ||
332 | 334 | ||
333 | skb->skb_iif = dev->ifindex; | 335 | skb->skb_iif = dev->ifindex; |
334 | dev->stats.tx_packets++; | 336 | dev->stats.tx_packets++; |