Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp576686img; Fri, 22 Mar 2019 04:23:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9N2TlASHCH53LwAHb33mrpcTuIeMR90ZleSYna1zEYhx/8mfoIcLZU4T5vkZuL1sHh2WZ X-Received: by 2002:a17:902:8a96:: with SMTP id p22mr8769307plo.113.1553253812849; Fri, 22 Mar 2019 04:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553253812; cv=none; d=google.com; s=arc-20160816; b=D4z9IRssfSkKijUlUjTEJ9sLh1KztBoMIOCqL9ZGlgNJpdMMrf9/f5zU+DaP/eESu4 WY61j9e51Kjqy/55PE+fuspZ4vpxbwvNW9ASHSuXaySrbotWO3r+2oj+rlf8IODM3kqy sdty7IjqoIxAIiW14vR7wXHPmEj4fnC/X0NBtvVrbPUO80zccbZtMT4sf4mP9KTIFj8x 10g+/iyjsuivAx68smTPV5vv+Poikgw1ibQh31so7XnVrJCQtFJdj3f9BAPvpDWBQRKc SdVWp12Hg5h3jl8BKy8S+ACtC/q9VXlhMDJN928YaeFUfTVH2+dgYvHh0AAFrvDCvfGJ YjfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=77nh2dsKu1gtExYjyWD58BucXZjFSilI6BQcyCoPdGc=; b=ejab3jfpZhq8/X8jkatrKHVmCXs2Wjew6N4ldj6341iLNsWa9IEjYSebWy6H0fI69I Bba5eazfxb+NG/wYwkMxA5urSaVvmaUJ+N9s+z1Lbq9yemTdFdyn9pJxMrfUHXvPBckD z8EwKu+sPk2e0qOgEdCVHZc7tTwjcAD3eI2frH8daDAnHDr80FtSruRAgZx9edidmG3C 4aRHbrbAOMVU1jAu4ptMq2eZrjAnKJuQ3JFY/bzCsmYJIjxVQEUOlKVe6qK1ZY5aYBDb rspg4LSm3arjY+/UYuGXTfRhwIabcCp9Q9tRQtHt1tEibNsDSL/wjNHjTEQnyGL2moxP M+Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qc8Fg62J; 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 h11si6555007pls.237.2019.03.22.04.23.15; Fri, 22 Mar 2019 04:23:32 -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=qc8Fg62J; 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 S1728407AbfCVLUh (ORCPT + 99 others); Fri, 22 Mar 2019 07:20:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:46956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728378AbfCVLUf (ORCPT ); Fri, 22 Mar 2019 07:20:35 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 7D5B0218A2; Fri, 22 Mar 2019 11:20:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253635; bh=UZct7VyJzDkFhM1VunJ4xm0GSdqm4lPiY/9uB2+R3YQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qc8Fg62JcX/tNNWCvZPoUedqC3XQyFrzNx+8Aslm9guY4acXnfst2l7thV4HJp3ER 3jC2hNlOTHCu0NG9Bkux0g7B8FNUAzsytOnj80Js7x90dtcpFLwz2621K45xBLpATj I3f8w+RTJAk8mLjTEmwqmlwf8CGnNDi0Hx6MM07Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kangjie Lu , Lee Jones , Sasha Levin Subject: [PATCH 3.18 009/134] mfd: mc13xxx: Fix a missing check of a register-read failure Date: Fri, 22 Mar 2019 12:13:42 +0100 Message-Id: <20190322111210.821552223@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 9e28989d41c0eab57ec0bb156617a8757406ff8a ] When mc13xxx_reg_read() fails, "old_adc0" is uninitialized and will contain random value. Further execution uses "old_adc0" even when mc13xxx_reg_read() fails. The fix checks the return value of mc13xxx_reg_read(), and exits the execution when it fails. Signed-off-by: Kangjie Lu Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/mc13xxx-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c index 64dde5d24b320..b5c8e5fe6af6d 100644 --- a/drivers/mfd/mc13xxx-core.c +++ b/drivers/mfd/mc13xxx-core.c @@ -274,7 +274,9 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode, mc13xxx->adcflags |= MC13XXX_ADC_WORKING; - mc13xxx_reg_read(mc13xxx, MC13XXX_ADC0, &old_adc0); + ret = mc13xxx_reg_read(mc13xxx, MC13XXX_ADC0, &old_adc0); + if (ret) + goto out; adc0 = MC13XXX_ADC0_ADINC1 | MC13XXX_ADC0_ADINC2; adc1 = MC13XXX_ADC1_ADEN | MC13XXX_ADC1_ADTRIGIGN | MC13XXX_ADC1_ASC; -- 2.19.1