Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6874801ybc; Thu, 28 Nov 2019 07:00:23 -0800 (PST) X-Google-Smtp-Source: APXvYqxQkY9LZBjfLgY/HbRJSTL+IY5mGm48TRFBdurJrottcBrmbvnCyuP/UWNUhDTwfU/sGW6p X-Received: by 2002:a17:906:4098:: with SMTP id u24mr54577443ejj.220.1574953223348; Thu, 28 Nov 2019 07:00:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574953223; cv=none; d=google.com; s=arc-20160816; b=EjTU/V7V2k2pVJO9qOZce8FwuC16hZ13GVE7sDDxiRo4TrICqU6gFir/LWO4R0frnO GdvuBuXzr9x9WRS5VbwG7RX//uUmaSsffpG+ZVEVRVQ1N5ePUVW/NUhHYwUTn9ZojVKK X8rXoJ7I+LXvn2I3TDMOudH1JivFhU5oqDeagDh0gjk0GrFT2m/dyvGuUY6LoXjgWpUI CBRBwQtkZwpBbh3U0yNYWZ0FZpecYt/UzXGJ85Tul+pwkPsYnE0tU6ivCHA5LJCHoh6G b5criDBuW56a96AetN93bp3lPkUJbK4yAgwN8B9gPce9Y83j+mcg+wK4ETf1Wl3mTlXF snkg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=A61btIRCfGl2K49FU+YApUFpLzedg3OmEOwCORD6qFU=; b=EMnTGFt6NiMJRMvphuJJV/a197JcGQW5Gp/TTMjvIOCFeUJudKqsU4WpBy0ncs1ZZ/ 46pybUV72Z4NwAYWDASPfBe+yg8kLYpOv5zQsua01Z7X37CzYwaXMRsi+bY028Go578I L1LUfl9JIMvY+sqEF3wDbHq52R12PBqYatzPrsd76PA7pGuiixGLeE/Y6qCR+XbbfdoW E3llVVrQ5Jf86dSHrJJO0p7mPK2EdIObvZLIfp9G2s1N9xgRZPEO4wU1jrwhcvl5ME/8 pdq3jFLxsV28CyI2O8QJuvSMVwPZ3LRXEIUY8MYQIBpgkkaoKj1ns9vGPPhNLyOGyGJa oaXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b="Hf/PPnAb"; 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 gy21si5007681ejb.38.2019.11.28.06.59.58; Thu, 28 Nov 2019 07:00:23 -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=@rasmusvillemoes.dk header.s=google header.b="Hf/PPnAb"; 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 S1727656AbfK1O6M (ORCPT + 99 others); Thu, 28 Nov 2019 09:58:12 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:42331 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727572AbfK1O6G (ORCPT ); Thu, 28 Nov 2019 09:58:06 -0500 Received: by mail-lf1-f65.google.com with SMTP id y19so20247565lfl.9 for ; Thu, 28 Nov 2019 06:58:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A61btIRCfGl2K49FU+YApUFpLzedg3OmEOwCORD6qFU=; b=Hf/PPnAbgXenT8bkLjfb4K/u1LbHRKbg0TAYF79JBnqjid3M76xfsO2Iqr0VVwnFyD rZNl4JtYAtUQD8Zu1LwxcvmtRvoRs1HGQ6aR9a88XKhA2wHLwBiX2tp7T944IhB1pgwY FAIkJLiijQAUm9eh3TF6qwqwuxYQZ78WxFPpM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A61btIRCfGl2K49FU+YApUFpLzedg3OmEOwCORD6qFU=; b=rQ4tfr9UXwVBrEKdWMwb8he3m77FE/EvhMPPlJ9ik1lN1I9PSnYYwIEhAEK4g42AXu BLznrTiyxXF1TBFke0wCtFaDWdb5Q3n6ccNi8fAhcAMy9dnxOm2eUbMtbla5JekfBN9T qPJ5G8kk1S5l5r6rFL49PHAjjEwqBgJAumRTXn7k68a9l8TJOVlVORvPlArkMdlOEzow x2xHwDCrNp/vohIOBj1wvGqf/3elaQDY11RLSc6o3uSBi2DGvh8B6RvoeD5vlfUoFFTc 1yToE4LNDaCOmsdQTk9v4dUH5KepRIWDsM4Mw0n0oX4y5J6NbNAyGg0cGHtP0Qo0XOWL /3DQ== X-Gm-Message-State: APjAAAXoh6Y7l0Qb0ZLmJQJGxxlaMS6/q6FvexKA2yxddq+jPHfzyGxT ukhk80M3DStuc2pQPHUfxdqwXID6htmqwRh4 X-Received: by 2002:a19:cc08:: with SMTP id c8mr32134885lfg.124.1574953084507; Thu, 28 Nov 2019 06:58:04 -0800 (PST) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id u2sm2456803lfl.18.2019.11.28.06.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 06:58:04 -0800 (PST) From: Rasmus Villemoes To: Qiang Zhao , Li Yang , Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Scott Wood , Timur Tabi , Rasmus Villemoes , netdev@vger.kernel.org Subject: [PATCH v6 46/49] net/wan/fsl_ucc_hdlc: reject muram offsets above 64K Date: Thu, 28 Nov 2019 15:55:51 +0100 Message-Id: <20191128145554.1297-47-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128145554.1297-1-linux@rasmusvillemoes.dk> References: <20191128145554.1297-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Qiang Zhao points out that these offsets get written to 16-bit registers, and there are some QE platforms with more than 64K muram. So it is possible that qe_muram_alloc() gives us an allocation that can't actually be used by the hardware, so detect and reject that. Reported-by: Qiang Zhao Reviewed-by: Timur Tabi Signed-off-by: Rasmus Villemoes --- drivers/net/wan/fsl_ucc_hdlc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c index 8d13586bb774..f029eaa7cfc0 100644 --- a/drivers/net/wan/fsl_ucc_hdlc.c +++ b/drivers/net/wan/fsl_ucc_hdlc.c @@ -245,6 +245,11 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) ret = -ENOMEM; goto free_riptr; } + if (riptr != (u16)riptr || tiptr != (u16)tiptr) { + dev_err(priv->dev, "MURAM allocation out of addressable range\n"); + ret = -ENOMEM; + goto free_tiptr; + } /* Set RIPTR, TIPTR */ iowrite16be(riptr, &priv->ucc_pram->riptr); -- 2.23.0