public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Dave Wiltshire <david.wiltshire@gmx.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, nsujir@broadcom.com,
	mchan@broadcom.com, rmody@brocade.com, jcliburn@gmail.com,
	chris.snook@gmail.com, jeffrey.t.kirsher@intel.com,
	bruce.w.allan@intel.com, alexander.h.duyck@intel.com,
	cooldavid@cooldavid.org, linux-driver@qlogic.com,
	linux-wimax@intel.com, wimax@linuxwimax.org,
	linux-wireless@vger.kernel.org, viro@zeniv.linux.org.uk,
	eparis@redhat.com, edumazet@google.com, dev@openvswitch.org,
	jhs@mojatatu.com
Subject: Re: [PATCH 1/3] skbuff: Update truesize in pskb_expand_head
Date: Wed, 12 Jun 2013 02:16:58 -0700	[thread overview]
Message-ID: <1371028618.3252.57.camel@edumazet-glaptop> (raw)
In-Reply-To: <1371027934-1955-2-git-send-email-david.wiltshire@gmx.com>

On Wed, 2013-06-12 at 19:05 +1000, Dave Wiltshire wrote:
> Some call sites to pskb_expand_head subsequently update the skb truesize
> and others don't (even with non-zero arguments). This is likely a memory
> audit leak. Fixed this up by moving the memory accounting to the
> skbuff.c file and removing it from the calling sites.
> 
> Signed-off-by: Dave Wiltshire <david.wiltshire@gmx.com>
> ---
>  drivers/net/wireless/mwl8k.c |    1 -
>  kernel/audit.c               |    2 --
>  net/core/skbuff.c            |    1 +
>  net/netlink/af_netlink.c     |    3 +--
>  net/wireless/util.c          |    2 --
>  5 files changed, 2 insertions(+), 7 deletions(-)

Ouch.

Sorry, you cannot do that.

skb->truesize is really complex, because there is a strong relation
between skb->truesize and memory accounting on sockets.

So pskb_expand_head() should not touch skb->truesize.

Only callers can do that when needed, and if possible.

An example of very careful truesize manipulation can be found in
tcp_tso_segment()

  reply	other threads:[~2013-06-12  9:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-12  9:05 [PATCH 0/3] skbuff: pskb_expand_head changes Dave Wiltshire
2013-06-12  9:05 ` [PATCH 1/3] skbuff: Update truesize in pskb_expand_head Dave Wiltshire
2013-06-12  9:16   ` Eric Dumazet [this message]
2013-06-12 23:35     ` Dave Wiltshire
2013-06-13  5:38       ` Eric Dumazet

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=1371028618.3252.57.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=bruce.w.allan@intel.com \
    --cc=chris.snook@gmail.com \
    --cc=cooldavid@cooldavid.org \
    --cc=davem@davemloft.net \
    --cc=david.wiltshire@gmx.com \
    --cc=dev@openvswitch.org \
    --cc=edumazet@google.com \
    --cc=eparis@redhat.com \
    --cc=jcliburn@gmail.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=linux-driver@qlogic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wimax@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=nsujir@broadcom.com \
    --cc=rmody@brocade.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wimax@linuxwimax.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