Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1934975imm; Thu, 24 May 2018 03:11:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqrpo7cXAGQhpmQuUKPkZnZx1aAK9sUzajnzl86A3KPPO86sN4WweOSsHVY/ZOh8S/HV+Kv X-Received: by 2002:a17:902:20c9:: with SMTP id v9-v6mr6709038plg.206.1527156708532; Thu, 24 May 2018 03:11:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527156708; cv=none; d=google.com; s=arc-20160816; b=v3h0mMzprPFtTGBF1VI+uZFBdPlGGXOBD6B4aykKKuAV3gRbtHlqgb3c40QEISc7Gp M1SOlneuNYgB5z9x7DFULZU2own89V91Lmkt1fjkJDrlUhy1uxpp0B8OAxo1J7FmKDMf oGTorMePGkyXcQn+jic3jUPoPgdd+Jg1FoX3MPUjyDCb/oOKZVtSZmrvV8UPqxrOFLIR RKJsVIxqOEKWp6+K4O+Vzqhz6xWuDpWFA9/qBPJTIbIAkou0+j3/X4ymH5j+4hN1wHMA 6td5rb1c+CU7yGNqbWsIFeNzcwVlX86/mHz627YA4CW0D2WBy7nD3DF5m5JISmN1ov+T rIrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=eI1s48287F1Hq7axbIkfWUInb4NMrQ2NVmxQnduebeA=; b=x0if1x8RJH9U9X5sdJ/kxrJC7RkTTK9dfMGioMhAIx1tBoxL85gttyaWnPqcTCPSBB 4MZcfF+khqzzYcKRkxn9J+sfPyCictXxofbhFRIYUSXLT7X5Yc8Uu9KM/69bVsOFrKtd 9WIGm+Xrgv+q9v+bl7qZssz/0ICWPUzUIpXRca/Njo24APWDGuxIEPcEBO9kNnnzfMi9 HqSj2N0oeqgMaqxBNGFBuIGmrsZGI6AICpJmwZtSFhcP4Gv86raIKiGIRSgzLbaCqHIg OMmfDZjT/JMQwwqWUdxFMXWd96yZJwoxb0AP+lIZcuKs+XQPQrgsTGUYRAIsQD1na4EN WLgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Wnv+Yqac; 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 az8-v6si21042223plb.347.2018.05.24.03.11.33; Thu, 24 May 2018 03:11:48 -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=Wnv+Yqac; 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 S1031769AbeEXKKl (ORCPT + 99 others); Thu, 24 May 2018 06:10:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:54676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031599AbeEXKFc (ORCPT ); Thu, 24 May 2018 06:05:32 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 C13E820891; Thu, 24 May 2018 10:05:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156332; bh=NKtGOs9mQc+Ch+SfmTkJLGP1piH16TzHfGjKzjnmuqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wnv+YqacglEJtQPlyXTZEjncW3vG0XjYUxuF4OWnIxMErEC4LWh2Arosmd7XCBSNw GK58d6iwtH7WX5B1SqDSNihStYvfHvTibc4UMgjblglvkoJoKmzeBhgNNPJAX/z0IG 8G0Il39cmy12lGAG65xmOyLg2Ml4C/Bzl1QMhFds= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Sasha Levin Subject: [PATCH 4.16 149/161] serial: mxs-auart: Fix out-of-bounds access through serial port index Date: Thu, 24 May 2018 11:39:34 +0200 Message-Id: <20180524093036.172129953@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Geert Uytterhoeven [ Upstream commit dd345a31bfdec350d2593e6de5964e55c7f19c76 ] 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 Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/mxs-auart.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -1663,6 +1663,10 @@ static int mxs_auart_probe(struct platfo 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;