linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: mike_phillips@urscorp.com
To: alan@lxorguk.ukuu.org.uk, linux-tr@linuxtr.net,
	linux-kernel@vger.kernel.org, sullivam@us.ibm.com
Subject: [PATCH] Memory Leak fix for ibmtr
Date: Thu, 1 Mar 2001 13:11:47 -0500	[thread overview]
Message-ID: <OF24EE3DF5.7589961C-ON85256A02.005DD6DE@urscorp.com> (raw)

Here is a small patch that fixes a memory leak in the ibmtr driver. 

Basically the bug occurs because the skb->tail pointer is set past the end 
of the skb data buffer. This causes problems when the skb's are cloned 
(they are unabled to be freed properly). The result is a leak that 
eventually will stop the system. 

Mike Phillips
Linux Token Ring Project
http://www.linuxtr.net 

--- linux.orig/drivers/net/tokenring/ibmtr.c    Wed Feb 14 16:49:55 2001
+++ linux/drivers/net/tokenring/ibmtr.c Wed Feb 14 16:50:01 2001
@@ -1716,7 +1716,8 @@
                }
 #endif
 
-               skb_size = length;
+       skb_size=(sizeof(struct trh_hdr)-lan_hdr_len+sizeof(struct 
trllc)+15) & ~15;
+               skb_size+=length;
 
                if (!(skb=dev_alloc_skb(skb_size))) {
                        DPRINTK("out of memory. frame dropped.\n");
@@ -1727,8 +1728,8 @@
                        return;
                }
 
-       skb_put(skb, length);
-       skb_reserve(skb, sizeof(struct trh_hdr)-lan_hdr_len+sizeof(struct 
trllc));
+       skb_reserve(skb, (sizeof(struct trh_hdr)-lan_hdr_len+sizeof(struct 
trllc)+15) & ~15);
+       skb_put(skb,length);
                skb->dev=dev;
                data=skb->data;
        rbuffer_len=ntohs(isa_readw(rbuffer + offsetof(struct rec_buf, 
buf_len)));

                 reply	other threads:[~2001-03-01 18:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OF24EE3DF5.7589961C-ON85256A02.005DD6DE@urscorp.com \
    --to=mike_phillips@urscorp.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tr@linuxtr.net \
    --cc=sullivam@us.ibm.com \
    --subject='Re: [PATCH] Memory Leak fix for ibmtr' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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