[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200227132238.056381768@linuxfoundation.org>
Date: Thu, 27 Feb 2020 14:35:21 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Qiang Zhao <qiang.zhao@....com>,
Timur Tabi <timur@...nel.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
"David S. Miller" <davem@...emloft.net>,
Li Yang <leoyang.li@....com>, Sasha Levin <sashal@...nel.org>
Subject: [PATCH 4.9 047/165] net/wan/fsl_ucc_hdlc: reject muram offsets above 64K
From: Rasmus Villemoes <linux@...musvillemoes.dk>
[ Upstream commit 148587a59f6b85831695e0497d9dd1af5f0495af ]
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 <qiang.zhao@....com>
Reviewed-by: Timur Tabi <timur@...nel.org>
Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
Acked-by: David S. Miller <davem@...emloft.net>
Signed-off-by: Li Yang <leoyang.li@....com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
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 af85a1b3135e2..87bf05a81db50 100644
--- a/drivers/net/wan/fsl_ucc_hdlc.c
+++ b/drivers/net/wan/fsl_ucc_hdlc.c
@@ -209,6 +209,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.20.1
Powered by blists - more mailing lists