Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2234760ybi; Thu, 20 Jun 2019 11:20:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnZ81n0lDcZj4plYIBSeSCzhWmlWAQkcb8UHsHIy5NH7UPG3Ameiuqu0TiMr9jYXih6GfF X-Received: by 2002:a17:90b:8d8:: with SMTP id ds24mr963520pjb.135.1561054803878; Thu, 20 Jun 2019 11:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561054803; cv=none; d=google.com; s=arc-20160816; b=NA7pbFmb+5CIB9APvoGLb/u7zNh0Vd/GacIndGPKqnfUPn/b4kcF/7YkQOEA6eN7L5 DA+aA3bhWah6W+6pTsP57JlIWE01vfCgWp3b4vKviv0kFmoMUOlA9yL9pKCZHeALdRhp vJ0DluPz+aomZfIJkx28pl26JNDOLgR3WuVjpFU9doIQ5No4D7CbUIC4EQaBMTlVoI0d dCpzDOMfNqi3rEUqzAeJUmXR5Ju50hkdapChFD1WROgUq0xYpa/tO4sZdAX2j9H7OUhc WKvPf5lRRYXM3d2Ksgo/Pq8FSrifbklAsz5V3cmYYwmOsTG0iHhaOd+I1TELLKZUm5Mc kwwQ== 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=gAG2OCO322P+ZDvxSlB7RFMNHpir6D0es4bsE++1YVQ=; b=UrYE5RlMVveY3/nqF0c67KLtSwO11Z5heyZdxenI4b1HHWKxE7upb5/eUreOw9/IET inTqwB89VDRkXmWbCJVv1CWptXxdNcnR5RoEb5YQQLq29qJZQLD4mJvJQA5fcOQBOsvp rYvN38ijYT0bb3MrXByf83GOWxDvTuBf4Fz+2DCEwxFrx2AiRvAJpTMAk4fBmkIflb2x 4/HjXBXONn4S1SRcIsC3I9pW8C10/vJhNE83QhxDB8+78FuITj71BVFPj15Y22WPUHtK IfTSXMSu0GHgwhMLmUyU/NJLtGKhDqhqhCD/YJhiG2AwuKwzKYm8f8TUJ8xFOJOc9be1 2+5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pZjYP0oE; 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 fr1si428582pjb.57.2019.06.20.11.19.48; Thu, 20 Jun 2019 11:20:03 -0700 (PDT) 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=pZjYP0oE; 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 S1729571AbfFTSPU (ORCPT + 99 others); Thu, 20 Jun 2019 14:15:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:43982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729561AbfFTSPR (ORCPT ); Thu, 20 Jun 2019 14:15:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 C062B205F4; Thu, 20 Jun 2019 18:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054516; bh=Bpe2oIicDkwZj51P8Zy0jF3Xpm0cXdZFcHkYKZ2DzI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pZjYP0oECHj6IYt1Fu1LxmZ6RJbVZbMrvHOfagkuCH8N3yATCPN9pdb2NUXdMZdf3 Q+GkJhjIfxoEwUV9i44uHso8Ij3cY6TNuUtMs4ub0my3FLO2P1nOZjySA1GVIQy/mO QbrrjTc7SIdFAXhTO1UVx3UbzmITsowmfiaCgs7w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ioana Radulescu , "David S. Miller" , Sasha Levin Subject: [PATCH 5.1 56/98] dpaa2-eth: Fix potential spectre issue Date: Thu, 20 Jun 2019 19:57:23 +0200 Message-Id: <20190620174351.874553506@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174349.443386789@linuxfoundation.org> References: <20190620174349.443386789@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit 5a20a093d965560f632b2ec325f8876918f78165 ] Smatch reports a potential spectre vulnerability in the dpaa2-eth driver, where the value of rxnfc->fs.location (which is provided from user-space) is used as index in an array. Add a call to array_index_nospec() to sanitize the access. Signed-off-by: Ioana Radulescu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c index 591dfcf76adb..0610fc0bebc2 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c @@ -4,6 +4,7 @@ */ #include +#include #include "dpni.h" /* DPNI_LINK_OPT_* */ #include "dpaa2-eth.h" @@ -589,6 +590,8 @@ static int dpaa2_eth_get_rxnfc(struct net_device *net_dev, case ETHTOOL_GRXCLSRULE: if (rxnfc->fs.location >= max_rules) return -EINVAL; + rxnfc->fs.location = array_index_nospec(rxnfc->fs.location, + max_rules); if (!priv->cls_rules[rxnfc->fs.location].in_use) return -EINVAL; rxnfc->fs = priv->cls_rules[rxnfc->fs.location].fs; -- 2.20.1