From: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
Stefan Roese <sr-ynQEQJNshbs@public.gmane.org>
Subject: Re: [PATCH] net: sun4i-emac: fix memory leak on bad packet
Date: Tue, 5 Aug 2014 23:07:04 +0200 [thread overview]
Message-ID: <20140805210704.GG2019@lukather> (raw)
In-Reply-To: <1407253479-30076-1-git-send-email-marc.zyngier-5wv7dgnIgG8@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]
On Tue, Aug 05, 2014 at 04:44:39PM +0100, Marc Zyngier wrote:
> Upon reception of a new frame, the emac driver checks for a number
> of error conditions, and flag the packet as "bad" if any of these
> are present. It then allocates a skb unconditionally, but only uses
> it if the packet is "good". On the error path, the skb is just forgotten,
> and the system leaks memory.
>
> The piece of junk I have on my desk seems to encounter such error
> frequently enough so that the box goes OOM after a couple of days,
> which makes me grumpy.
>
> Fix this by moving the allocation on the "good_packet" path (and
> convert it to netdev_alloc_skb while we're at it).
>
> Tested on a random Allwinner A20 board.
>
> Cc: Stefan Roese <sr-ynQEQJNshbs@public.gmane.org>
> Cc: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # 3.11+
> Signed-off-by: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>
Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2014-08-05 21:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-05 15:44 [PATCH] net: sun4i-emac: fix memory leak on bad packet Marc Zyngier
[not found] ` <1407253479-30076-1-git-send-email-marc.zyngier-5wv7dgnIgG8@public.gmane.org>
2014-08-05 21:07 ` Maxime Ripard [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=20140805210704.GG2019@lukather \
--to=maxime.ripard-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
--cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
--cc=marc.zyngier-5wv7dgnIgG8@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sr-ynQEQJNshbs@public.gmane.org \
/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).