Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp560455imp; Thu, 21 Feb 2019 06:52:44 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib6wzgcqlD/klHCzeAgQD1I25UWP6TkH/au/VcaYSDn1wsBRIDpJfd/FNtgz/bEKLNWwkR9 X-Received: by 2002:a17:902:f095:: with SMTP id go21mr42025305plb.199.1550760764031; Thu, 21 Feb 2019 06:52:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550760764; cv=none; d=google.com; s=arc-20160816; b=Ixk1cv/KarrtdRzcz8+bsg948SZIowRXpTWp4VSYlkVv1D5vWCnLpnH2TxxE7zSByw vx66CZzYJaaYonkNH6y9qWZl2C1pBlWZStjm01QOiJ6IkzHs4eSGZLtRGjgqGvjIwJnF JmdLYP1lQinLmCtOpvJaRipU4x172HKrUt2G20Gf9Gt+WL2KdmRdmV8pRNQRuEzRbxLN sizwZdDK1ezdq/wPD1eSSCSClzwnRCOxWl365kFOdULRWEsZsoYApThupHE9C/h6D4yT gKZLpLn6rCOxPEZ0Fg+SIUsfot2m4meum91V9TwIFj4EnWdlpjETjfv+yXG5COn5tJGx gwJw== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5PNp1wqARPblV/3l59nUMeYCuCXH4WZHCC2q/Jf0+wM=; b=BjCfgaROEg/JJCy16z4bGU5OUay07PuIg5nHN99wCm+cMy2QfYB7nIqNruc2B8lROf MuaY+P+x0/YWpQaHxy/4Gw3EVvQ38xwxX8ZZmydxX41NTBtNADxOshvAA5r7d5VoOXeH cbb+vvPR5HEIqYDMCud58Fk4YtT4+bCwhPBOjkARrTwVnRu5INcVfYI69yOf4Ia0KOKX +tqrDgHe2XzVYi2LptYUOZ2OpXVskQ55YMqNQPfVYPslEaieJU8KTpiM3hZcuW5+pOQH cUl7fVBZxODbClNtWtttygcxOqBx6L82Q2ks9OHI8wJakXaHqUq7xpQQAzjoCz73H4Ib wqeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fysCxfqU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n20si21991908plp.294.2019.02.21.06.52.28; Thu, 21 Feb 2019 06:52:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fysCxfqU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728641AbfBUOiS (ORCPT + 99 others); Thu, 21 Feb 2019 09:38:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:59912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbfBUOiQ (ORCPT ); Thu, 21 Feb 2019 09:38:16 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 D7DA920838; Thu, 21 Feb 2019 14:38:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550759895; bh=+KlOeo7X8g7HG4wIeRYW+rdcLWZwYsjlSTGxC3UYNtk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fysCxfqULL2EqrfzdFF1kzPxsudaJrcqmplJzR8dXdNLS+240wMlPgOQfiQH/imHY 0RNOM7oUOtA3wvdlYIk/hc8xX+Xhp43OND8/SGGSsW9d6SXqqzuL6ppuAQgPADnhhl eTQYjyQQddZ5W42qD3C34sXY517Qkpen4lQSe7Tw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Alexander Duyck , "David S. Miller" Subject: [PATCH 4.4 08/20] net: Do not allocate page fragments that are not skb aligned Date: Thu, 21 Feb 2019 15:35:38 +0100 Message-Id: <20190221141947.012165914@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221141946.772985220@linuxfoundation.org> References: <20190221141946.772985220@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexander Duyck [ Upstream commit 3bed3cc4156eedf652b4df72bdb35d4f1a2a739d ] This patch addresses the fact that there are drivers, specifically tun, that will call into the network page fragment allocators with buffer sizes that are not cache aligned. Doing this could result in data alignment and DMA performance issues as these fragment pools are also shared with the skb allocator and any other devices that will use napi_alloc_frags or netdev_alloc_frags. Fixes: ffde7328a36d ("net: Split netdev_alloc_frag into __alloc_page_frag and add __napi_alloc_frag") Reported-by: Jann Horn Signed-off-by: Alexander Duyck Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/skbuff.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -374,6 +374,8 @@ static void *__netdev_alloc_frag(unsigne */ void *netdev_alloc_frag(unsigned int fragsz) { + fragsz = SKB_DATA_ALIGN(fragsz); + return __netdev_alloc_frag(fragsz, GFP_ATOMIC | __GFP_COLD); } EXPORT_SYMBOL(netdev_alloc_frag); @@ -387,6 +389,8 @@ static void *__napi_alloc_frag(unsigned void *napi_alloc_frag(unsigned int fragsz) { + fragsz = SKB_DATA_ALIGN(fragsz); + return __napi_alloc_frag(fragsz, GFP_ATOMIC | __GFP_COLD); } EXPORT_SYMBOL(napi_alloc_frag);