Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3209106pxb; Mon, 9 Nov 2020 05:39:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJymcvGicWHpLbKpq6zKNZjtws6FBLFtJUYY6ygRDU9Kew/CEaIrV//BCmQb7k+KBH3bThUc X-Received: by 2002:a50:dac9:: with SMTP id s9mr14928513edj.75.1604929147621; Mon, 09 Nov 2020 05:39:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604929147; cv=none; d=google.com; s=arc-20160816; b=TI12v9OJh1pZGq/PMu3r4yDgkoDwxiygqDoe2sl9HHngorAEGCpTJHvLLEuKnlwRfj l+cVeqgSBm7NJaRBy4JRd8+mRhZf4LH9ndT17oHou1MaIvKWdPhWkbModAf0gbeMQaoq e8wUZaxwEic7kYFYfL0qciYR5yjqjazzJPpDstuRG57RJY1hiIjWvJdzIEESM7h8Yq5E m4E9Pc9/J0fGXZAclGoloAnfz2i4lk1QwdeqdsTbstUoyeoLbcHH0NJtQ6ob0x4oqUXg PjdZkE1IYtmcEXPtOtQLICVq/W52LUoxQ8Zm/9/aKWMcfagdjZV87y280Qhtmt5bkSR3 U6WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0Q5sFDz/O72r3LiWu2y1e1ZnughfPT8y+o2v8eGVTQo=; b=edaYeyS5wi7fbxexlqllNwulZYSo1fq+qszGRBG2/eChB/KaR9EqMdnffN2JELO4Cf 7cRP8C5P48n3qkh+VIof9zi7r+rn+IHGxvaiOfG0svnKjtZ8zDCD8X2cGEWqEb+2Y5JR LNdNdDbLRxcVMAfTI9X4RX9yJJ1153o32aDf23I0T2OAKHNgLuqvm/qNYVC7PXlF/vLQ biEQamtiwG2ApDfdOdq5CdN9/fYj+j2MPzNpsQGohFGxGdqR0bsRRvnQjGhqpPwJz8Zj N8Tga0XuecbgFCmYj2C05C0KlqqMXr+ExOcu64t9+Y7Abf/X4rWNyFWQBFKYUJly2Pyf whcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=skx4KJok; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k20si6863055ejx.736.2020.11.09.05.38.45; Mon, 09 Nov 2020 05:39:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=skx4KJok; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732116AbgKINh1 (ORCPT + 99 others); Mon, 9 Nov 2020 08:37:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:57350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730733AbgKINEN (ORCPT ); Mon, 9 Nov 2020 08:04:13 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3B26F20684; Mon, 9 Nov 2020 13:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927052; bh=kOandtB1ZMev2Spg8KASy1z02WsLM2ai2Cy10DWXrx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=skx4KJokOVPTpJsrhQt1A9MlPgTAEj1auKqLzAQ5hGjqSIrKQnmEPWvGWFM/SLfar L/63VS9TYsaaJ9hTTDab2mmgXbT+fzHGErFd1opc7B1tRZqK7wrF9UQuPFwZZhi8SZ kdEEG/teQNjto5sLOFZ07TtP7YA/PSQtreKzx2ZQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Jurack , Claudiu Manoil , Jakub Kicinski Subject: [PATCH 4.9 095/117] gianfar: Account for Tx PTP timestamp in the skb headroom Date: Mon, 9 Nov 2020 13:55:21 +0100 Message-Id: <20201109125030.207921453@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125025.630721781@linuxfoundation.org> References: <20201109125025.630721781@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Claudiu Manoil [ Upstream commit d6a076d68c6b5d6a5800f3990a513facb7016dea ] When PTP timestamping is enabled on Tx, the controller inserts the Tx timestamp at the beginning of the frame buffer, between SFD and the L2 frame header. This means that the skb provided by the stack is required to have enough headroom otherwise a new skb needs to be created by the driver to accommodate the timestamp inserted by h/w. Up until now the driver was relying on the second option, using skb_realloc_headroom() to create a new skb to accommodate PTP frames. Turns out that this method is not reliable, as reallocation of skbs for PTP frames along with the required overhead (skb_set_owner_w, consume_skb) is causing random crashes in subsequent skb_*() calls, when multiple concurrent TCP streams are run at the same time on the same device (as seen in James' report). Note that these crashes don't occur with a single TCP stream, nor with multiple concurrent UDP streams, but only when multiple TCP streams are run concurrently with the PTP packet flow (doing skb reallocation). This patch enforces the first method, by requesting enough headroom from the stack to accommodate PTP frames, and so avoiding skb_realloc_headroom() & co, and the crashes no longer occur. There's no reason not to set needed_headroom to a large enough value to accommodate PTP frames, so in this regard this patch is a fix. Reported-by: James Jurack Fixes: bee9e58c9e98 ("gianfar:don't add FCB length to hard_header_len") Signed-off-by: Claudiu Manoil Link: https://lore.kernel.org/r/20201020173605.1173-1-claudiu.manoil@nxp.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/freescale/gianfar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -1385,7 +1385,7 @@ static int gfar_probe(struct platform_de if (dev->features & NETIF_F_IP_CSUM || priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) - dev->needed_headroom = GMAC_FCB_LEN; + dev->needed_headroom = GMAC_FCB_LEN + GMAC_TXPAL_LEN; /* Initializing some of the rx/tx queue level parameters */ for (i = 0; i < priv->num_tx_queues; i++) {