提交 fcefbe9f 编写于 作者: A Alan Ott 提交者: David S. Miller

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: NAlan Ott <alan@signal11.us>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b333b7e6
...@@ -85,6 +85,7 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb, ...@@ -85,6 +85,7 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
if (!(priv->phy->channels_supported[page] & (1 << chan))) { if (!(priv->phy->channels_supported[page] & (1 << chan))) {
WARN_ON(1); WARN_ON(1);
kfree_skb(skb);
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
...@@ -103,8 +104,10 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb, ...@@ -103,8 +104,10 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
} }
work = kzalloc(sizeof(struct xmit_work), GFP_ATOMIC); work = kzalloc(sizeof(struct xmit_work), GFP_ATOMIC);
if (!work) if (!work) {
kfree_skb(skb);
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
}
INIT_WORK(&work->work, mac802154_xmit_worker); INIT_WORK(&work->work, mac802154_xmit_worker);
work->skb = skb; work->skb = skb;
......
...@@ -327,8 +327,10 @@ mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -327,8 +327,10 @@ mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
if (chan == MAC802154_CHAN_NONE || if (chan == MAC802154_CHAN_NONE ||
page >= WPAN_NUM_PAGES || page >= WPAN_NUM_PAGES ||
chan >= WPAN_NUM_CHANNELS) chan >= WPAN_NUM_CHANNELS) {
kfree_skb(skb);
return NETDEV_TX_OK; return NETDEV_TX_OK;
}
skb->skb_iif = dev->ifindex; skb->skb_iif = dev->ifindex;
dev->stats.tx_packets++; dev->stats.tx_packets++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册