netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: dwmw2@infradead.org
Cc: netdev@vger.kernel.org, simon@fire.lp0.eu,
	linux-atm-general@lists.sourceforge.net, nathan@traverse.com.au
Subject: Re: [PATCH RFC] solos-pci: Fix BUG() with shared skb
Date: Wed, 04 Sep 2013 17:51:47 -0400 (EDT)	[thread overview]
Message-ID: <20130904.175147.516807555661755710.davem@davemloft.net> (raw)
In-Reply-To: <1378327275.2627.28.camel@shinybook.infradead.org>

From: David Woodhouse <dwmw2@infradead.org>
Date: Wed, 04 Sep 2013 21:41:15 +0100

> On Wed, 2013-09-04 at 14:30 -0400, David Miller wrote:
>> skb_realloc_headroom() should do everything you need.
> 
> Great, thanks! Something like this then... ? 
> 
> Do I really need the truesize check? And if so, is there a better way to
> handle the ATM accounting? It just *happens* to be the case that the the
> br2684_pop() and pppoatm_pop() functions don't mind being bypassed in
> this fashion, and we should probably get away with tweaking the core ATM
> accounting directly like this. Doesn't make me happy though...
 ...
> +		nskb = skb_realloc_headroom(skb, sizeof(*header));
> +		if (!nskb) {
> +			solos_pop(vcc, skb);
> +			return -ENOMEM;
> +		}
> +		if (skb->truesize != nskb->truesize)
> +			atm_force_charge(vcc, nskb->truesize - skb->truesize);

My understanding is that truesize will not be changed by calls to
skb_realloc_headroom(), because if it did then every ethernet driver
would be screwed as the skb->truesize adjustment would corrupt socket
memory accounting.

The only thing you need to be mindful is that after the
skb_realloc_headroom() call all skb data pointers change, and
therefore things like packet pointers are now stale and need to be
recalculated.

  reply	other threads:[~2013-09-04 21:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03 15:45 [PATCH RFC] solos-pci: Fix BUG() with shared skb David Woodhouse
2013-09-04 18:30 ` David Miller
2013-09-04 20:41   ` David Woodhouse
2013-09-04 21:51     ` David Miller [this message]
2015-09-15 19:10     ` David Woodhouse
2015-09-16 11:32       ` Simon Arlott

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=20130904.175147.516807555661755710.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=dwmw2@infradead.org \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=nathan@traverse.com.au \
    --cc=netdev@vger.kernel.org \
    --cc=simon@fire.lp0.eu \
    /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).