netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: simon@fire.lp0.eu
Cc: netdev@vger.kernel.org, linux-atm-general@lists.sourceforge.net
Subject: Re: [PATCH RFC] solos-pci: Fix BUG() with shared skb
Date: Tue, 15 Sep 2015 20:10:43 +0100	[thread overview]
Message-ID: <1442344243.131189.26.camel@infradead.org> (raw)
In-Reply-To: <1378327275.2627.28.camel@shinybook.infradead.org>

[-- Attachment #1: Type: text/plain, Size: 1840 bytes --]

On Wed, 2013-09-04 at 21:41 +0100, David Woodhouse wrote:
> 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... ? 
>
> diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
> index 32784d1..4492c0f 100644
> --- a/drivers/atm/solos-pci.c
> +++ b/drivers/atm/solos-pci.c
> @@ -1145,19 +1145,19 @@ static int psend(struct atm_vcc *vcc, struct sk_buff *skb)
>  > 	> 	> return 0;
>  > 	> }
>  
> -> 	> if (!skb_clone_writable(skb, sizeof(*header))) {
> -> 	> 	> int expand_by = 0;
> -> 	> 	> int ret;
> -
> -> 	> 	> if (skb_headroom(skb) < sizeof(*header))
> -> 	> 	> 	> expand_by = sizeof(*header) - skb_headroom(skb);
> -
> -> 	> 	> ret = pskb_expand_head(skb, expand_by, 0, GFP_ATOMIC);
> -> 	> 	> if (ret) {
> -> 	> 	> 	> dev_warn(&card->dev->dev, "pskb_expand_head failed.\n");
> -> 	> 	> 	> solos_pop(vcc, skb);
> -> 	> 	> 	> return ret;
> -> 	> 	> }
> +> 	> if (skb_headroom(skb) < sizeof(*header)) {
> +> 	> 	> struct sk_buff *nskb;
> +
> +> 	> 	> 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);
> + 
> +> 	> 	> dev_kfree_skb_any(skb);
> +> 	> 	> skb = nskb;
>  > 	> }
>  
>  > 	> header = (void *)skb_push(skb, sizeof(*header));

Simon, did you ever test this?
Can you still (tell me how to) reproduce the original problem? I think
that sending on br2684 was necessary but not sufficient...?

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5691 bytes --]

  parent reply	other threads:[~2015-09-15 19:10 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
2015-09-15 19:10     ` David Woodhouse [this message]
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=1442344243.131189.26.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=linux-atm-general@lists.sourceforge.net \
    --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).