linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Chuang <yhchuang@realtek.com>
To: Thomas Pedersen <thomas@adapt-ip.com>,
	Nick Owens <mischief@offblast.org>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: RE: [PATCH] rtw88: fix skb_under_panic in tx path
Date: Mon, 29 Jun 2020 05:20:09 +0000	[thread overview]
Message-ID: <e42b0d0e87b2461a9b023e432635e6a6@realtek.com> (raw)
In-Reply-To: <3d8546b66a4f2027a7fab1de291ec40f@adapt-ip.com>

> On 2020-06-25 13:18, Nick Owens wrote:
> > hello :)
> 
> Hi Nick :)
> 
> > this change fixes a reliable crash on my thinkpad A485.
> >
> > please note i have no prior experience doing kernel development or
> > sending patches, and i'm not sure if this is a correct approach.
> 
> You probably want to submit patches with git-send-email. See
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatch
> es
> 
> > From aa589182d30a0f99e1b3201ed4f3830e8af71dac Mon Sep 17 00:00:00
> 2001
> > From: Nick Owens <mischief@offblast.org>
> > Date: Thu, 25 Jun 2020 12:55:41 -0700
> > Subject: [PATCH] rtw88: fix skb_under_panic in tx path
> >
> > fixes the following panic on my thinkpad A485
> >
> > Oops#1 Part3
> > <0>[ 3743.881656] skbuff: skb_under_panic: text:000000005f69fd98
> > len:208 put:48 head:000000009e2719e8 data:00000000bd3795e0 tail:0xc2
> > end:0x2c0 dev:wlp2s0
> 
> skb->head and skb->data here are really far (0.5GB) apart. Maybe
> skb->data actually got corrupted earlier?
> 
> > diff --git a/drivers/net/wireless/realtek/rtw88/pci.c
> > b/drivers/net/wireless/realtek/rtw88/pci.c
> > index d735f3127fe8..21b3b268cb25 100644
> > --- a/drivers/net/wireless/realtek/rtw88/pci.c
> > +++ b/drivers/net/wireless/realtek/rtw88/pci.c
> > @@ -741,6 +741,12 @@ static int rtw_pci_tx_write_data(struct rtw_dev
> > *rtwdev,
> >  	else if (!avail_desc(ring->r.wp, ring->r.rp, ring->r.len))
> >  		return -ENOSPC;
> >
> > +	if (skb_headroom(skb) < chip->tx_pkt_desc_sz &&
> > +	    pskb_expand_head(skb, chip->tx_pkt_desc_sz - skb_headroom(skb),
> > 0, GFP_ATOMIC)) {
> > +		dev_err(rtwdev->dev, "no headroom available");
> > +		return -ENOMEM;
> > +	}
> > +
> 
> If it is a headroom issue, you can actually express the needed headroom
> needed by the driver in hw->extra_tx_headroom during init and avoid the
> pskb_expand_head() here.
> 

Looks like a headroom issue, but the driver already assigned headroom.
	max_tx_headroom = rtwdev->chip->tx_pkt_desc_sz;
	hw->extra_tx_headroom = max_tx_headroom;

Then I am not sure why this happens. Nick, can you help to dump_stack()
so we can see where is the skb from?

Yen-Hsuan

  reply	other threads:[~2020-06-29 18:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25 20:18 [PATCH] rtw88: fix skb_under_panic in tx path Nick Owens
2020-06-26  0:10 ` Thomas Pedersen
2020-06-29  5:20   ` Tony Chuang [this message]
2020-11-21  1:43     ` Brian Norris

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=e42b0d0e87b2461a9b023e432635e6a6@realtek.com \
    --to=yhchuang@realtek.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mischief@offblast.org \
    --cc=thomas@adapt-ip.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).