Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9980951ybi; Wed, 24 Jul 2019 13:28:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwElUoXWYe9tw4Okk/dG58ZrgBh0/dGBJpY/H2B5GhRFx0wYoB/AdWH1Jv+vfA/OV337Jby X-Received: by 2002:a63:fb43:: with SMTP id w3mr47632526pgj.403.1564000127306; Wed, 24 Jul 2019 13:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564000127; cv=none; d=google.com; s=arc-20160816; b=OXl9j36ypPOTWRW7qDk3Jn7t9lQYZJ27K8I4q9MEooxwsqcs3Yo3AZ+xBc9X4ePGqx 5rDuiMsqEGhgvPtKLfND5V3zXo18Kxn0wA/INr3DEE9IpcTUYcp3+I+ZcyqF65JnYZfp 8SZig2FFPazNqY0fgiUUdfIhfaBWfhU7PLUKv9ZgwlUbwX9rkhNpU/eSunEWKZbIehxj sjicTb2ooxrrfwnAnBGHgDhPdrRrfXZ2Xy6DmNYicltDhROM7De1QqnO4cgb0SW852J7 EbnJX9fCz6kEIJulWA0Pmr8N21IySJ+L+/YkUfxn7NQN52NaozVf0oyk3GuZOg6RcHwz SoqQ== 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=bjCh2M1EJMQDqHsxrrLp9RCsydZaG/UXPVga524V5s8=; b=LdGSM5ahsWHswuFYXXN5ZWOrc7oqqELjKTTLG5y6uF/w9QnWmoMMsTCutRAtzHByDz Bsj5mRqjfT44NFpXCWLrECKqT3SEWRHdETUHe3TyfDe3kP+k+VbnuPRgiSqJ0yEGoyOY iYiKq6mPYepdGY90AzLIMR3wCQHzxMUbCN54yudTweR7L4nIN79U4E5kV2VlQmRaks2a 4himuds/ZF4I8GKsacwm807FqFFAo4S+BGUhW75FJUUW2Zy8Fscrdkw9ZjrIOjPRimt3 bDqeDgl2vRocYGF6kHVN/rxcC55HTHU09HRaMkzorIOpKCppgNSujxqpNYQ+BA2YMm8x uG2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lRZM3P1G; 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 f26si2358040pfk.81.2019.07.24.13.28.32; Wed, 24 Jul 2019 13:28:47 -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=lRZM3P1G; 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 S1728976AbfGXTgx (ORCPT + 99 others); Wed, 24 Jul 2019 15:36:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:36642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388478AbfGXTgs (ORCPT ); Wed, 24 Jul 2019 15:36:48 -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 817F8214AF; Wed, 24 Jul 2019 19:36:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997008; bh=+mBgDTHX626pF5vBCtD6RPqgeKtvu0Nlkai0i99PfMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lRZM3P1G6S8k8d3gizVZ4Iyv9xu+pQdMe2ObHwFbw1MJE0XaS7M4bQ0g/cmE6ey8F XIBsAsQGCJ8n8jclRATO+CKo5ML8uV17q4WJaIDIgBiEm6kRYRlk7AD2OvPdigMhPF bl3ntI/YhQAC0KbZkVLEYJpJry+TzBvH23FJbmvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Mark Brown Subject: [PATCH 5.2 290/413] regulator: s2mps11: Fix ERR_PTR dereference on GPIO lookup failure Date: Wed, 24 Jul 2019 21:19:41 +0200 Message-Id: <20190724191756.978272502@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Krzysztof Kozlowski commit 70ca117b02f3b1c8830fe95e4e3dea2937038e11 upstream. If devm_gpiod_get_from_of_node() call returns ERR_PTR, it is assigned into an array of GPIO descriptors and used later because such error is not treated as critical thus it is not propagated back to the probe function. All code later expects that such GPIO descriptor is either a NULL or proper value. This later might lead to dereference of ERR_PTR. Only devices with S2MPS14 flavor are affected (other do not control regulators with GPIOs). Fixes: 1c984942f0a4 ("regulator: s2mps11: Pass descriptor instead of GPIO number") Cc: Signed-off-by: Krzysztof Kozlowski Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/regulator/s2mps11.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -826,6 +826,7 @@ static void s2mps14_pmic_dt_parse_ext_co else if (IS_ERR(gpio[reg])) { dev_err(&pdev->dev, "Failed to get control GPIO for %d/%s\n", reg, rdata[reg].name); + gpio[reg] = NULL; continue; } if (gpio[reg])