Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1915109imm; Thu, 24 May 2018 02:52:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrkyQ+g1d4W/cSGZ0i3bKmOAztTUxmCcqsUJLxInky+ZZUWip8SkdRkcSf07O/m4cdHE4Sz X-Received: by 2002:a17:902:4b:: with SMTP id 69-v6mr6800801pla.178.1527155528928; Thu, 24 May 2018 02:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527155528; cv=none; d=google.com; s=arc-20160816; b=xxIGd3NiWw1S6uZ6fYjsR/xM9m7m4cL5R2sknqdVjdNuRN+rtyO98NNoptcoo5W+vw k5lckx/Oy7Uh4pPNrvQauBt4vkpCvAUfE/rvxxcXiq570uiibRHjXMQnLmqyD27KGme1 Kjl2vRHkw5PWRy8tqbNARBoj1801s+ZmtU1baSujcXOQ9qr9A8smCxDbJAaLgSr/QH79 me3HAUeQRStyOXvsn8SAl4a8mi2qYnP+IuXsmKVoY9+ZS8qfCdiIdMMTkSv9rUMtNQGV Q8ZiQPhTwqdL4Wf3jPi3aGnAQRPieYrftNcljsZIeAPpVSpuMnS46UZ0giSnNXjJtwke d0Aw== 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=m+UuS2BuThKBQR+w6aoTQi6LlhB7gk/5umBKg5mOISs=; b=CH+wBYgABFwQynmJ3IkSvc3mnqBmo/owjaqtCu9dIAnw3ajLyN7P3VCIvfZJGaSsYT vMAUEEC2WJYsE9Daf9H7BOvuDTowkk+xjGchAnsIRqG8lCj9G/Eshr6WjB3YnfECpJ1I LQ0WIfdJT4RPNdZ4WUTYJT3s77PsXFfBJFgbZab50x0okWZ5onAyJIlZVKMTr1Bwpw5U zUvXePnCxXRtAWZtuZ5ng/W9jTlXbLmphCjv/S6CEMzCI8Ble9WvN2wx9ovzIROGLHTD SDXKlLDhVrZnQ5uhCysByeopCi4z9BKAiO7+aCXRgwh8muHiyQIrDyLjsR88NpVkOJeD B4tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ntvgTjaQ; 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 y139-v6si21547014pfc.163.2018.05.24.02.51.54; Thu, 24 May 2018 02:52:08 -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=ntvgTjaQ; 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 S967454AbeEXJu6 (ORCPT + 99 others); Thu, 24 May 2018 05:50:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:43420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967636AbeEXJuw (ORCPT ); Thu, 24 May 2018 05:50:52 -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 F280D208C4; Thu, 24 May 2018 09:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155451; bh=ylq2olEpFYxVlQZ7waRYGipnFQUOV5+Tx4+7EHVzln8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ntvgTjaQeZ3i7EVVRNJtWSRpQAFiAvLWOzpfwmwudEM9gvSCVBqasskdmej12yKZ7 PWFOfl4WQnlgqbF/J+kMChdjLl/F/WjJsoytUc3WMf8pI2tyBcTdejdsKB3F4v/mj3 JflfEvMRe8XKf1OXbedZ4RWjCvfZ1aMu35gRTvHo= 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.9 89/96] serial: mxs-auart: Fix out-of-bounds access through serial port index Date: Thu, 24 May 2018 11:39:12 +0200 Message-Id: <20180524093610.701261507@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093605.602125311@linuxfoundation.org> References: <20180524093605.602125311@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.9-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 @@ -1664,6 +1664,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;