Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2972996ybt; Mon, 29 Jun 2020 11:50:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCP3CGHsaCKPQmwo5rJ99LGELBiIfUOk9a17LPs7DLZrTC0bm4ox6adIfSt1PC/NhPtUT6 X-Received: by 2002:a05:6402:16db:: with SMTP id r27mr19518246edx.139.1593456655655; Mon, 29 Jun 2020 11:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593456655; cv=none; d=google.com; s=arc-20160816; b=sqHxj3C/z94YDHhJIDy6z/cYABsb5V/rWvSQP6VOv5xqKYKXzHAgSEoK6D9Y39agfj F9c0qf++nKjLMDvJ0VTZXzvb9F0iNVC3ImW1fbpD0lEJ5SddXXWB5LVn0OWHG+zBojWW OcUv27tzQ7NCXjATQiPjoQiH2sTQk78J48bbGNdzRcJFFQwyaiwHuD8/yJv1EsKrvuN1 lmN2pxUbChEzu/8l/PwOTZvRhcB7bmhsYdBRE+Tnirkug4wOL9w7LKNDHCmNlTK4OAsZ yteysSFQgokX1w5ekzy7VCFFyIFfsGj5Icf5B+NpGCd1UlX3ujjZ4BkJcZxCgNFtUjtV 4JEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=SgAWKEgftMbtEa2BF8kEIUi1qrNJgCgv1eW9CV7VLUY=; b=zDY6rv2+vL7wm1PPr76ZQzYI+YgJ90bA40wBas12GWe0Qc+R1A6F/sZhVMiAtVCH14 HpTwTnJiwxPG/V7xL/QDAI/PP7lgzBISZAqGpMgj8PHfkt66e0Va/ALd2ElSs3kxc8nL L+IeuwPaqw/Gk6T22VTwx8QA17IE92/wAnqYzmejQW+262YvWgboU7oqyS+iklLQ+K7w qA3uAF3uNMy25LJ/qlPR6UqSGFyluMHFhNzz+lIqim7nNCh8UtwdzgcX7rg7YJAyC73k i8YNTQ0CQ2nznWrHD5lRfdBDDU8xIcSdgTc6l4OdNX8hKhVURCwAPtybU8oYMAH7ieuN JiIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w15si225242edi.136.2020.06.29.11.50.31; Mon, 29 Jun 2020 11:50:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728155AbgF2Su1 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 29 Jun 2020 14:50:27 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:34474 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728989AbgF2SuY (ORCPT ); Mon, 29 Jun 2020 14:50:24 -0400 X-SpamFilter-By: ArmorX SpamTrap 5.69 with qID 05T5KAPd8027358, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexmb06.realtek.com.tw[172.21.6.99]) by rtits2.realtek.com.tw (8.15.2/2.66/5.86) with ESMTPS id 05T5KAPd8027358 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 29 Jun 2020 13:20:10 +0800 Received: from RTEXMB03.realtek.com.tw (172.21.6.96) by RTEXMB06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Mon, 29 Jun 2020 13:20:10 +0800 Received: from RTEXMB04.realtek.com.tw (172.21.6.97) by RTEXMB03.realtek.com.tw (172.21.6.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Mon, 29 Jun 2020 13:20:10 +0800 Received: from RTEXMB04.realtek.com.tw ([fe80::941:6388:7d34:5c44]) by RTEXMB04.realtek.com.tw ([fe80::941:6388:7d34:5c44%3]) with mapi id 15.01.1779.005; Mon, 29 Jun 2020 13:20:10 +0800 From: Tony Chuang To: Thomas Pedersen , Nick Owens CC: "linux-wireless@vger.kernel.org" Subject: RE: [PATCH] rtw88: fix skb_under_panic in tx path Thread-Topic: [PATCH] rtw88: fix skb_under_panic in tx path Thread-Index: AQHWSy3fNWZ7ZTAl2026K9XMJhOX9ajpgAiAgAWS6IA= Date: Mon, 29 Jun 2020 05:20:09 +0000 Message-ID: References: <20200625201857.almm27xgzburyxxu@wololo.home.arpa> <3d8546b66a4f2027a7fab1de291ec40f@adapt-ip.com> In-Reply-To: <3d8546b66a4f2027a7fab1de291ec40f@adapt-ip.com> Accept-Language: zh-TW, en-US Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.21.68.175] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org > 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 > > 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