mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/2] w35und: plug memory leak in wbsoft_tx()
@ 2008-10-27 22:14 Pekka J Enberg
  2008-10-28 19:32 ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Pekka J Enberg @ 2008-10-27 22:14 UTC (permalink / raw)
  To: greg; +Cc: pavel, linux-kernel

From: Pekka Enberg <penberg@cs.helsinki.fi>

There's no reason to duplicate the skb in wbsoft_tx() and leak GFP_ATOMIC
memory as the contents are copied to ->TxBuffer in MdxTx() anyway before
MLMESendFrame() returns.

Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 drivers/staging/winbond/linux/wbusb.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/winbond/linux/wbusb.c b/drivers/staging/winbond/linux/wbusb.c
index 128b70a..8957634 100644
--- a/drivers/staging/winbond/linux/wbusb.c
+++ b/drivers/staging/winbond/linux/wbusb.c
@@ -114,11 +114,8 @@ static void wbsoft_configure_filter(struct ieee80211_hw *dev,
 
 static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
 {
-	char *buffer = kmalloc(skb->len, GFP_ATOMIC);
-	printk("Sending frame %d bytes\n", skb->len);
-	memcpy(buffer, skb->data, skb->len);
-	if (1 == MLMESendFrame(my_adapter, buffer, skb->len, FRAME_TYPE_802_11_MANAGEMENT))
-		printk("frame sent ok (%d bytes)?\n", skb->len);
+	MLMESendFrame(my_adapter, skb->data, skb->len, FRAME_TYPE_802_11_MANAGEMENT);
+
 	return NETDEV_TX_OK;
 }
 
-- 
1.5.3.7


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] w35und: plug memory leak in wbsoft_tx()
  2008-10-27 22:14 [PATCH 2/2] w35und: plug memory leak in wbsoft_tx() Pekka J Enberg
@ 2008-10-28 19:32 ` Pavel Machek
  2008-10-28 21:08   ` Pekka Enberg
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2008-10-28 19:32 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: greg, linux-kernel

On Tue 2008-10-28 00:14:38, Pekka J Enberg wrote:
> From: Pekka Enberg <penberg@cs.helsinki.fi>
> 
> There's no reason to duplicate the skb in wbsoft_tx() and leak GFP_ATOMIC
> memory as the contents are copied to ->TxBuffer in MdxTx() anyway before
> MLMESendFrame() returns.

Acked-by: Pavel Machek <pavel@suse.cz>

...but I guess I should test the this after it hits the mainline...
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] w35und: plug memory leak in wbsoft_tx()
  2008-10-28 19:32 ` Pavel Machek
@ 2008-10-28 21:08   ` Pekka Enberg
  2008-10-30 14:55     ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Pekka Enberg @ 2008-10-28 21:08 UTC (permalink / raw)
  To: Pavel Machek; +Cc: greg, linux-kernel

On Tue 2008-10-28 00:14:38, Pekka J Enberg wrote:
>> From: Pekka Enberg <penberg@cs.helsinki.fi>
>>
>> There's no reason to duplicate the skb in wbsoft_tx() and leak GFP_ATOMIC
>> memory as the contents are copied to ->TxBuffer in MdxTx() anyway before
>> MLMESendFrame() returns.

On Tue, Oct 28, 2008 at 9:32 PM, Pavel Machek <pavel@suse.cz> wrote:
> Acked-by: Pavel Machek <pavel@suse.cz>
>
> ...but I guess I should test the this after it hits the mainline...

For sure. I'm bit surprised no one noticed this before as it seems to
be leaking memory for every transmitted frame...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] w35und: plug memory leak in wbsoft_tx()
  2008-10-28 21:08   ` Pekka Enberg
@ 2008-10-30 14:55     ` Pavel Machek
  0 siblings, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2008-10-30 14:55 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: greg, linux-kernel

On Tue 2008-10-28 23:08:50, Pekka Enberg wrote:
> On Tue 2008-10-28 00:14:38, Pekka J Enberg wrote:
> >> From: Pekka Enberg <penberg@cs.helsinki.fi>
> >>
> >> There's no reason to duplicate the skb in wbsoft_tx() and leak GFP_ATOMIC
> >> memory as the contents are copied to ->TxBuffer in MdxTx() anyway before
> >> MLMESendFrame() returns.
> 
> On Tue, Oct 28, 2008 at 9:32 PM, Pavel Machek <pavel@suse.cz> wrote:
> > Acked-by: Pavel Machek <pavel@suse.cz>
> >
> > ...but I guess I should test the this after it hits the mainline...
> 
> For sure. I'm bit surprised no one noticed this before as it seems to
> be leaking memory for every transmitted frame...

Well, I'm not quite surprised.  I noticed the driver stops working
after a while, but at that point it was a small miracle that it worked
at all...

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-10-30 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-27 22:14 [PATCH 2/2] w35und: plug memory leak in wbsoft_tx() Pekka J Enberg
2008-10-28 19:32 ` Pavel Machek
2008-10-28 21:08   ` Pekka Enberg
2008-10-30 14:55     ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®