Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10409372ybi; Wed, 24 Jul 2019 22:42:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4nQn/PtQw6eUnGr+iQAlm6O5SUO9mrOZ1vJU5YPUvEnfotzYCSk/rVsXigs8KkO2nqpUR X-Received: by 2002:a63:5452:: with SMTP id e18mr68431226pgm.232.1564033335943; Wed, 24 Jul 2019 22:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564033335; cv=none; d=google.com; s=arc-20160816; b=A0xbs4hwG+OogGPMmQeLHnwh31jCbOdczr5C/o+7MuJwZYKiJDHkQw7USxC1+hJbeX NpwGvu19WzHqjmsFOKeLJMxRPkIFwv8TV+gVrw2Cnteqz7oLWouKtz57u8ehW9VY28KN XLVRTYUBcdeTNwbQi1RuainNnuHTWsh0UQtJ2abMITqMNtRJulD6yqNAJSlxXQPUKaXm 2Qh/4+QFpxpKmvLQBWz48vmd0ndumvnvm6341H2P35fEN3K5tAGPHfTNfEjIICsXrpTj Mul9XJFDrnJc7xCfE2mow2U+LfhPvIUrvWC3eEn36B3+lAulqXTAIE3imdQsrtx6Ynro g3cg== 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=I8En+bOcABxnbbWXZx6ixLYpON0RGSiTxI83PqgQMbTI/UgDeeoeC1fFk+F7VASxii zeWKKAL56vXk7XDNtPDK3bk8AQ9tbzWbV5tgfG8ztpExyK/nLZEZ152QUNqIJBkoOXOg VHsI719lY4XYEY3xf8UsQKoKy8dklShyaLn5uA7L2HrAK6X+YgWwEwW5m/HYWBgIz1e6 xmIegwpBs68EG+A5YyPYFLDPfrhaFsHY11jD5GAbMNI7AyDQkxgZ9EWeKijfc7/5KXlQ /3fzkriDuF0isCXU6RScxEgYNuXZmdfowXP/Qi1FWNsh+9TKQ4efXCwBjF8yx710HJtg 0lVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KwQJ9c9s; 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 64si16394627plk.87.2019.07.24.22.42.01; Wed, 24 Jul 2019 22:42:15 -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=KwQJ9c9s; 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 S2404758AbfGXUN5 (ORCPT + 99 others); Wed, 24 Jul 2019 16:13:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:39916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388123AbfGXTzy (ORCPT ); Wed, 24 Jul 2019 15:55:54 -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 DD59C205C9; Wed, 24 Jul 2019 19:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998154; bh=+mBgDTHX626pF5vBCtD6RPqgeKtvu0Nlkai0i99PfMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KwQJ9c9sGnEOtyMu830h7VI+Y5vVSGbRcHoyyK25aYsKRWn0EUHCepxOoDrPuvM9T lN9bu61EwvqlSgetX7Uv/8WhbnhlQ+2egZQEyvdKvH7C75G2nkUT1VycIq9/Srejxe 8pu+jk5dhcgaxPJPAJuXotfdauTiT/7F2ljL2Jko= 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.1 266/371] regulator: s2mps11: Fix ERR_PTR dereference on GPIO lookup failure Date: Wed, 24 Jul 2019 21:20:18 +0200 Message-Id: <20190724191744.390594072@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191724.382593077@linuxfoundation.org> References: <20190724191724.382593077@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])