From: Alexander Aring <alex.aring@gmail.com>
To: Martin Townsend <mtownsend1973@gmail.com>
Cc: linux-zigbee-devel@lists.sourceforge.net,
linux-bluetooth@vger.kernel.org
Subject: Re: [Linux-zigbee-devel] [PATCH 2/2] Change lowpan_rcv so skb is freed within function and fix return values.
Date: Thu, 31 Jul 2014 08:26:11 +0200 [thread overview]
Message-ID: <20140731062610.GC26557@omega> (raw)
In-Reply-To: <20140731055427.GB26557@omega>
On Thu, Jul 31, 2014 at 07:54:27AM +0200, Alexander Aring wrote:
...
> >
> > raw_dump_inline(NULL,
> > @@ -179,10 +179,10 @@ static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr,
> >
> > new = skb_copy_expand(skb, sizeof(struct ipv6hdr),
> > skb_tailroom(skb), GFP_ATOMIC);
> > - kfree_skb(skb);
> > -
> > if (!new)
> > - return -ENOMEM;
> > + return -1;
> > +
> > + kfree_skb(skb);
>
> This leaks memory here, move kfree_skb above the condition after the
> skb_copy_expand. This should be also a consume_skb or dev_kfree_skb, we
> should not mix these function in this file and use only one of them.
>
> We need another patch for this.
>
Ah, no there is no memory leaking sorry. You removed also the
kfree_skb(skb) in the drop label and we do this at one place to detect if
an error occur.
Maybe we can return the errno at the drop label and set err = -ENOMEM
and do a goto drop.
- Alex
prev parent reply other threads:[~2014-07-31 6:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1406733923-21700-1-git-send-email-martin.townsend@xsilon.com>
[not found] ` <1406733923-21700-2-git-send-email-martin.townsend@xsilon.com>
2014-07-31 5:33 ` [Linux-zigbee-devel] [PATCH 1/2] Remove dev parameter from skb_delivery_cb in 6lowpan Alexander Aring
[not found] ` <1406733923-21700-3-git-send-email-martin.townsend@xsilon.com>
2014-07-31 5:54 ` [Linux-zigbee-devel] [PATCH 2/2] Change lowpan_rcv so skb is freed within function and fix return values Alexander Aring
2014-07-31 6:26 ` Alexander Aring [this message]
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=20140731062610.GC26557@omega \
--to=alex.aring@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-zigbee-devel@lists.sourceforge.net \
--cc=mtownsend1973@gmail.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).