Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp128342ybt; Thu, 25 Jun 2020 17:13:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5RnPvVIX+60Tb+B4EAgNtXEfFiWXSaK+4tFUHfKbpmMCKVQUPPdirxhFbUk8j2p/Ep9pb X-Received: by 2002:a17:906:970a:: with SMTP id k10mr321232ejx.236.1593130413788; Thu, 25 Jun 2020 17:13:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593130413; cv=none; d=google.com; s=arc-20160816; b=a8dpSWDJQ1ltuvPaWIfhkh+8xaZyBFqtSbkQpJSXhlV6v4BdAaHGeXAzh7Uc2BzYKZ QgavMP6MfB/wBcxqHioq6VN83Ei0Mj9uHBdAN+TFRf2nWJq8kIJe8jDS9YlJbgjmz7wf IIhEH9subay0E17uxD+OGIMEC+hO/5HPfjSHlMrbtyufXoEJMHLn9fEKV7n9PjEgL+fU /5uvDSkjjqyIE4XNJtOu2El7vbI0weB9eA7gbgXwdwQP3ZspX7hrk8yoxp4GMRPNT7Pa p6WIIwINzzBq/O59j/K2PJgMRs2PG7EXQLPXNabiiVNeAclRPh0/wqWXt7vMItHnw6va PFGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:message-id :user-agent:references:in-reply-to:subject:cc:to:from:date :mime-version; bh=KR2xUmo2SRQ9Io0tDjq8cgmVaO1X7KTgTZzoTZHiIr4=; b=bMSK+OB2UyxKM445mrPjO0egc/B3JTlUiKDaY3wUpbGCBjTuN/+ZKo6yd8gwONwt+7 eXKmZcRuKwUW2V+p3RTNpFwvMQRBUhjCBKod0kOd84+mMGla+7eU0qh0rHVPMerrosIn g+0xBlrZj0D1HPTMjOOrKUPNnqQ+uK18GXljyaOLb1+gTJY33ELwimkn9EnQ2DFcDByd XRw7wChiCqBrmjPOB68DAbL7x2HHKX6+WD3jOpyyPOmofwZTVujIVK0FwxRSThR9vMte mbZY3byxQIl+lUcxB4Rmet1VHBtDCOY0Syea04qDgQtoUDzsXcatZVzoMyG197GvZD1F +uOw== 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 y2si15983410edu.320.2020.06.25.17.13.09; Thu, 25 Jun 2020 17:13:33 -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 S1725801AbgFZAK4 (ORCPT + 99 others); Thu, 25 Jun 2020 20:10:56 -0400 Received: from mail.adapt-ip.com ([173.164.178.19]:46966 "EHLO web.adapt-ip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725767AbgFZAK4 (ORCPT ); Thu, 25 Jun 2020 20:10:56 -0400 Received: from localhost (localhost [127.0.0.1]) by web.adapt-ip.com (Postfix) with ESMTP id 8BF104F7791; Fri, 26 Jun 2020 00:10:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at web.adapt-ip.com Received: from web.adapt-ip.com ([127.0.0.1]) by localhost (web.adapt-ip.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id dAWo6bD_FtmL; Fri, 26 Jun 2020 00:10:52 +0000 (UTC) Received: from mail.ibsgaard.io (c-73-202-5-52.hsd1.ca.comcast.net [73.202.5.52]) (Authenticated sender: thomas@adapt-ip.com) by web.adapt-ip.com (Postfix) with ESMTPSA id CDDA34F9333; Fri, 26 Jun 2020 00:10:51 +0000 (UTC) MIME-Version: 1.0 Date: Thu, 25 Jun 2020 17:10:51 -0700 From: Thomas Pedersen To: Nick Owens Cc: linux-wireless@vger.kernel.org, Yan-Hsuan Chuang Subject: Re: [PATCH] rtw88: fix skb_under_panic in tx path In-Reply-To: <20200625201857.almm27xgzburyxxu@wololo.home.arpa> References: <20200625201857.almm27xgzburyxxu@wololo.home.arpa> User-Agent: Roundcube Webmail/1.4.5 Message-ID: <3d8546b66a4f2027a7fab1de291ec40f@adapt-ip.com> X-Sender: thomas@adapt-ip.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit 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/submittingpatches > 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. -- thomas