Message ID | 1519393117-31998-5-git-send-email-geert+renesas@glider.be |
---|---|
State | New |
Headers | show
Return-Path: <linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NiFIiWEe"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="hPwU/VrA"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zntRB00V3z9sW9 for <incoming@patchwork.ozlabs.org>; Sat, 24 Feb 2018 01:10:29 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ofgNUZZwzQjj7YQ7ETvwboNlQUnCho8Yz8LSceASRHg=; b=NiFIiWEexOTr2VzL7cChgzhdrO XoiTuRpYzdkq6XehmrbYBZXpXkWN4CPHewtdii8JK1mOk5xA4a7gDUN4F1Lu6KL+zWX2ArMDmPBJy J/j1Cb5jhqa23VLsT9pSvEioboedaoR1tYMSDIZIpzDmmG45b6pZx05ZpimEXEWCl7iUrVrmIwhbR qVOP8xvLqLC3fHudJO8/V/l8DBcp38RC8TrO/EiIKlE6PtI5h9ZxWINnMtgdVHaV3RVYl41dOB3HV cT1d+h+NUEdkZrBVUA5v9Cpu9syUxPBq+EVvp4zjhFnu01XHXZ+OAGpATImsDTU7Ei8VUeVMRx/hh 1DLtsF4w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1epE3P-0005g5-11; Fri, 23 Feb 2018 14:10:27 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1epDny-0003Kl-Jq for linux-snps-arc@bombadil.infradead.org; Fri, 23 Feb 2018 13:54:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GL1IiAKboj0ubCF5Cs0c+3UxaTIf4d+x0Kye2291EGo=; b=hPwU/VrA1cgRXzIgCwwMrSl+q F3CdA5Z1NReExZgi9+MbQn4L4w6NCQ4YcDk3pelWVS8GIrrYjHDMxMwkRVLybYVuIuS/IbL/u57ef 9e3ptBvUXRo67LaVamxgimRoqPZRUSOKEslPnf7KamMpnVqd493Gs0sjfPUsieuwCg2jYNrEGNmeh FOhSX6iQone5fRZdisbiwzAdmFVYETZgMuHjookeSoCkqQjVhllIqVuIjoAUjgqet3n9bJ6DV0JDh UNPgROYCkhI5L+I77dx43PBWrw6o3xnL+DnsBIOeLGS4KADZV+FsDhL0vSPoPoqjFq/Djogn7Ab4/ dQHs5TpSQ==; Received: from newton.telenet-ops.be ([195.130.132.45]) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1epDYv-0003Xo-7X for linux-snps-arc@lists.infradead.org; Fri, 23 Feb 2018 13:39:01 +0000 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by newton.telenet-ops.be (Postfix) with ESMTPS id 3znskY4FSDzMqyt3 for <linux-snps-arc@lists.infradead.org>; Fri, 23 Feb 2018 14:38:45 +0100 (CET) Received: from ayla.of.borg ([84.194.111.163]) by michel.telenet-ops.be with bizsmtp id EDee1x00c3XaVaC06DeehS; Fri, 23 Feb 2018 14:38:41 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from <geert@linux-m68k.org>) id 1epDYc-0004si-NA; Fri, 23 Feb 2018 14:38:38 +0100 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from <geert@linux-m68k.org>) id 1epDYc-0008LY-LR; Fri, 23 Feb 2018 14:38:38 +0100 From: Geert Uytterhoeven <geert+renesas@glider.be> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Subject: [PATCH v2 4/9] serial: mxs-auart: Fix out-of-bounds access through serial port index Date: Fri, 23 Feb 2018 14:38:32 +0100 Message-Id: <1519393117-31998-5-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519393117-31998-1-git-send-email-geert+renesas@glider.be> References: <1519393117-31998-1-git-send-email-geert+renesas@glider.be> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180223_133857_302018_70A3DEBB X-CRM114-Status: UNSURE ( 9.51 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.4 (--) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-2.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [195.130.132.45 listed in list.dnswl.org] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors <linux-snps-arc.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-snps-arc>, <mailto:linux-snps-arc-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-snps-arc/> List-Post: <mailto:linux-snps-arc@lists.infradead.org> List-Help: <mailto:linux-snps-arc-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-snps-arc>, <mailto:linux-snps-arc-request@lists.infradead.org?subject=subscribe> Cc: devicetree@vger.kernel.org, Barry Song <baohua@kernel.org>, Geert Uytterhoeven <geert+renesas@glider.be>, Vineet Gupta <vgupta@synopsys.com>, Michal Simek <michal.simek@xilinx.com>, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-serial@vger.kernel.org, Jiri Slaby <jslaby@suse.com>, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-snps-arc" <linux-snps-arc-bounces@lists.infradead.org> Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
serial: Fix out-of-bounds accesses through DT aliases
|
expand
|
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 079dc47aa142d8e1..caa8a41b6e71df9e 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -1663,6 +1663,10 @@ static int mxs_auart_probe(struct platform_device *pdev) s->port.line = pdev->id < 0 ? 0 : pdev->id; else if (ret < 0) return ret; + if (s->port.line >= ARRAY_SIZE(auart_port)) { + dev_err(&pdev->dev, "serial%d out of range\n", s->port.line); + return -EINVAL; + } if (of_id) { pdev->id_entry = of_id->data;
The auart_port[] array is indexed using a value derived from the "serialN" alias in DT, or from platform data, which may lead to an out-of-bounds access. Fix this by adding a range check. Fixes: 1ea6607d4cdc9179 ("serial: mxs-auart: Allow device tree probing") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- v2: - Fix Fixes reference, - Use ARRAY_SIZE(), - Update patch description for platform data. --- drivers/tty/serial/mxs-auart.c | 4 ++++ 1 file changed, 4 insertions(+)