Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755906Ab2K3EZN (ORCPT ); Thu, 29 Nov 2012 23:25:13 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:45912 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753463Ab2K3EZL (ORCPT ); Thu, 29 Nov 2012 23:25:11 -0500 X-Sasl-enc: pZvxcUK8aCS/Cn7q4iu7fKPc3Zw5TXFx0XL4GX0eRLwo 1354249510 From: Alan Ott To: Alexander Smirnov , Dmitry Eremin-Solenikov , "David S. Miller" , Eric Dumazet Cc: linux-zigbee-devel@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Alan Ott Subject: [PATCH 1/2] mac802154: fix memory leaks Date: Thu, 29 Nov 2012 23:25:10 -0500 Message-Id: <1354249511-8086-1-git-send-email-alan@signal11.us> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <504EA95C.9010003@signal11.us> References: <504EA95C.9010003@signal11.us> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1656 Lines: 57 kfree_skb() was not getting called in the case of some failures. This was pointed out by Eric Dumazet. Signed-off-by: Alan Ott --- net/mac802154/tx.c | 5 ++++- 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 1a4df39..db63914 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, if (!(priv->phy->channels_supported[page] & (1 << chan))) { WARN_ON(1); + kfree_skb(skb); return NETDEV_TX_OK; } @@ -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); - if (!work) + if (!work) { + kfree_skb(skb); return NETDEV_TX_BUSY; + } INIT_WORK(&work->work, mac802154_xmit_worker); work->skb = skb; diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c index f30f6d4..1191039 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) if (chan == MAC802154_CHAN_NONE || page >= WPAN_NUM_PAGES || - chan >= WPAN_NUM_CHANNELS) + chan >= WPAN_NUM_CHANNELS) { + kfree_skb(skb); return NETDEV_TX_OK; + } skb->skb_iif = dev->ifindex; dev->stats.tx_packets++; -- 1.7.11.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/