Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1921978imm; Thu, 24 May 2018 02:59:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZol4dcpmf8+qY9WplJE1h6rsqVvg2ddldvIEaZKIrh9tz/WmZJALV7+Ygk79K6Q8O4Rc8Gj X-Received: by 2002:a17:902:a616:: with SMTP id u22-v6mr6752037plq.186.1527155994844; Thu, 24 May 2018 02:59:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527155994; cv=none; d=google.com; s=arc-20160816; b=ZPWMpBqx0YxKmNdyv5h7V+vkIrszCVmYlFl/0EdBQxdD7DvQqmzsoYpUGsIZW/oKqL 06+NodYeYVlU/hSXpIEGtt/1WJpFZN+NYiNME3ixcpYir/hd5LwFRwyIV37wnK330CcF 4N7mFawAz1UqK+oRi81aP3T3QVtCTKzv2kVBb0nevvbhCMnlGvDvEE2LlvXMcQkYCmAq cbFbwkrnsQGH78Esh6IEWXOp6kzgVbbJVBZQbatauCFDzRKnIp+hUI46rlt5yiLakEWE vNUH90Os62kO5Kom6crDTRRwzbTiuj+CTSi84j5B0JSgArMQb7zAqERELNVvkBFboP6b EDZw== 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=x0+a1gLuB/LM+olhzVnHQZJpZY/+WLIG5utPga4JajE=; b=xVj7BtLXrn/6NCq4DE4lPk0x56K6AbQPX0+EYVRrl73EpzJJ8nvah57T+IZdTM82Vg l+ugXkXQ/XOx4zFkoYjHa9d6p/xS+iVNnmnyrGxHNZYC18nXW1TVnxH+R5EYingBFwlW gO34ujcp7rCeAdzx/TsvYzyTyH3Ig09ykeudrejD/mOdkZyl9uzYarcpBRdfGSbglu0y swigmh5ykvKYszURArAHwvQzjZVAix3Ofk4Lu53PIrXeW+NgA/NsUNcwVmuwnCJVeO2B 2PcyEx3b7vm5itfs40Goi0mi/l16qSiOJKGpdbP/IS3xNRp+oZmxEbd9ZDfigoZm//66 CnzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PbtJF1Ds; 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 j9-v6si20569640plk.587.2018.05.24.02.59.40; Thu, 24 May 2018 02:59:54 -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=PbtJF1Ds; 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 S1030690AbeEXJ6u (ORCPT + 99 others); Thu, 24 May 2018 05:58:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:38890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030662AbeEXJ6o (ORCPT ); Thu, 24 May 2018 05:58:44 -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 EE7AA2089A; Thu, 24 May 2018 09:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155923; bh=KVcOYJsDRKg5GHubsUTQJeIjHfXaidgTSN7xGz4EReo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PbtJF1DsH5iNPbVTwXv71HvKfceeb45Pf4dv8VdQU4QAgDsaMcHVeCYDGX8laypsn rCfhEZiprv39NaRZePR9ASt+tmJSBvpZb9cBz2pwTjxaUegNrGg9tS+1oKwc0HyOs9 RtScqR8SibAkydhk1rZ/g3TyRxCYzmMXoyCcAMwQ= 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.14 153/165] serial: mxs-auart: Fix out-of-bounds access through serial port index Date: Thu, 24 May 2018 11:39:19 +0200 Message-Id: <20180524093628.266764549@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@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.14-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 @@ -1667,6 +1667,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;