Received: by 10.223.185.116 with SMTP id b49csp5458846wrg; Wed, 7 Mar 2018 12:07:03 -0800 (PST) X-Google-Smtp-Source: AG47ELulm5uahd+3pS9c9vB6lTVF8RUMFrTMy8TC7gU7YN3EJ+gGlPqD+jKJ+1Niz1atu9wDwUsG X-Received: by 2002:a17:902:8c97:: with SMTP id t23-v6mr21583562plo.372.1520453223613; Wed, 07 Mar 2018 12:07:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520453223; cv=none; d=google.com; s=arc-20160816; b=lvystKiHxoDC2gOe/qb7hK7Ds2O1ZVlC4r7bMY/ZTPVxUNicp8sILP+FQNPN/FImbV s6Ce6SlnArMwn+GG2dhFEMuu+VQnbkR6nbAJPlQ6kaMhBaAWBjFfqwhvPd8TBtoHzAaP GfXUP8utAjm5oyZ4gOgwmtoQuVe7rfYnbWJYrQf9RJYzTKoDV/6OJYhms3zPblO5JmY4 MZEP5BvVgqgq5zpY7krkUPYSuXl+/agEb77bmNg+RgdGSnI6SXsyB9uiakcQSjyvI0Jn OHxXUOcXZQDH/kg591Fh7YhjxWENajPieT+aZBTTtvA0fS646h0hm2G/E45ppEbIBDcI 64gw== 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 :arc-authentication-results; bh=pI9eTdcnJM+I8RGjA63yVM8cD+iuJ0MwOVfIvOwV46k=; b=ipT/KsZ/1r7EBNL/Uw15HmVZgOZ87o198E2i1ftrdpCox97jc9fTl30WtlcHEGxZ4w bb15y/XSujtt475urNy5n29giaAWGlI4Y/qZ+OMUnXxe0FttF6zNcDgkFcdo9SPnFgkj awjaHJA/Q4Ac1lDi7btJHzX+WVpbmlsVjEcKfrnJVinL5OwxowJH5EDDFTP5Z4TJrcXz f52FuE19tSPpR7KuqiWKXX6KoE2xAGMMBYWmPhnLbWOz1vVPN43TVyDqBua26XPKwkWB 3Dms2imVdogvCRTiv/5faJg8GbAaDLcQOsA3ir/ammXDUrJf72hCArh4jdF9IZQ/44wz 6TPg== ARC-Authentication-Results: i=1; mx.google.com; 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 u13-v6si13169308plq.823.2018.03.07.12.06.48; Wed, 07 Mar 2018 12:07:03 -0800 (PST) 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; 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 S965499AbeCGTqO (ORCPT + 99 others); Wed, 7 Mar 2018 14:46:14 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44460 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965465AbeCGTqG (ORCPT ); Wed, 7 Mar 2018 14:46:06 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BA6511023; Wed, 7 Mar 2018 19:46:05 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Shawn Lin , Ulf Hansson Subject: [PATCH 4.14 016/110] mmc: dw_mmc-k3: Fix out-of-bounds access through DT alias Date: Wed, 7 Mar 2018 11:37:59 -0800 Message-Id: <20180307191041.821628597@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191039.748351103@linuxfoundation.org> References: <20180307191039.748351103@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 commit 325501d9360eb42c7c51e6daa0d733844c1e790b upstream. The hs_timing_cfg[] array is indexed using a value derived from the "mshcN" alias in DT, which may lead to an out-of-bounds access. Fix this by adding a range check. Fixes: 361c7fe9b02eee7e ("mmc: dw_mmc-k3: add sd support for hi3660") Signed-off-by: Geert Uytterhoeven Reviewed-by: Shawn Lin Cc: Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/dw_mmc-k3.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/mmc/host/dw_mmc-k3.c +++ b/drivers/mmc/host/dw_mmc-k3.c @@ -135,6 +135,9 @@ static int dw_mci_hi6220_parse_dt(struct if (priv->ctrl_id < 0) priv->ctrl_id = 0; + if (priv->ctrl_id >= TIMING_MODE) + return -EINVAL; + host->priv = priv; return 0; }