Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2267572ybl; Thu, 19 Dec 2019 10:42:53 -0800 (PST) X-Google-Smtp-Source: APXvYqyMJnNvBCnFAuT2KbtFWbSBhYgyY/9/wdo6ftMa9oHWnWNSJwSKxZLWlczfC3qVbIqKQAki X-Received: by 2002:a05:6830:2006:: with SMTP id e6mr9670652otp.367.1576780973313; Thu, 19 Dec 2019 10:42:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576780973; cv=none; d=google.com; s=arc-20160816; b=HRh5izz3sahN6r7o6F6yw7+afNkqLChvdvaxVXZEX9BvRZxveT8lLcEJVmoiRdJAJA 6IR6T+wVWTlwrZAu+YzfevmJkVLbM+w0fpZ+HwNyTC0wqp5r/T9MkFCQ0A/leY6fpcIk JLzJqaY23FFpTsNgieKkeuSKVL+UxeCnFVvoVIn2k1dMhY6g+cYFk4YR8YtrVZkzOSdp eRgYQNkLuq/pG8BFkXWPeBv+uOvfuBDtIzMJ1uhFW8fdk/fAex4do6aFMtilV1ryb7EC cfwvhPe3LGroY2gKtytSQZhpQNt9HFdaTH4zy/Q6o/h9qRHxiEdDwWMRKjXcofFho5uD AAUQ== 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=Yl15Zv0tHSpQs4ABEkTpl/XXqwM+AhunHTPe0P9CLjA=; b=l5bKNL8D2vucDqmCHAX62rrwzdTD5cxPJv3AY2XiYX90jtbvrMcRYggODxPtZfIBol B2SkxOUJtS6GDDSb+O9esSzlE1Ad/22GkV0XK5fuLeE1KXuCwqXrZUpm0cQEzNDXugtg VauJwSOy0KeSksxhbTI+Key1c30Q+3OcgMLS7RfNR5am04X5l0IpBng2NoDzA9oUwZy/ HYPyw7fGzLcOWN8egtMxULR9x50mVigEF3801JHP1WPpql6Cs9yp6Ie8kQbZBMucWkeF 1OjhuKBTp7b9idnRoUawMZsHBcOiPDLC7YtS6L+Kog8Flc9TaULtWmrevmf4x0ICV23o h+IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OZWYM+k2; 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 m25si3522965otn.208.2019.12.19.10.42.40; Thu, 19 Dec 2019 10:42:53 -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; dkim=pass header.i=@kernel.org header.s=default header.b=OZWYM+k2; 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 S1728528AbfLSSlX (ORCPT + 99 others); Thu, 19 Dec 2019 13:41:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:60352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728520AbfLSSlV (ORCPT ); Thu, 19 Dec 2019 13:41:21 -0500 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 E1DFC206D7; Thu, 19 Dec 2019 18:41:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576780880; bh=IUtYO+uS0Eddzxw4xtQEOjWU5msvKA9bePjJTUT7/rY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OZWYM+k2wbkxOEV2W4KYQvPAqIe7Azasyekmsmp82zuW++wcKiJkyk9geadGEpQ4v nhXFWP0mHeAKPr3I1v6cnKFy7ULQjH9ig+bBS26f/iXe/s3eewLRMX01ONala5uNuq toUqi7Jxc1hopgHALSaar182SOBFvTwF5+2Z3zhA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski Subject: [PATCH 4.4 117/162] pinctrl: samsung: Fix device node refcount leaks in S3C24xx wakeup controller init Date: Thu, 19 Dec 2019 19:33:45 +0100 Message-Id: <20191219183214.873454724@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183150.477687052@linuxfoundation.org> References: <20191219183150.477687052@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 6fbbcb050802d6ea109f387e961b1dbcc3a80c96 upstream. In s3c24xx_eint_init() the for_each_child_of_node() loop is used with a break to find a matching child node. Although each iteration of for_each_child_of_node puts the previous node, but early exit from loop misses it. This leads to leak of device node. Cc: Fixes: af99a7507469 ("pinctrl: Add pinctrl-s3c24xx driver") Signed-off-by: Krzysztof Kozlowski Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/samsung/pinctrl-s3c24xx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c +++ b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c @@ -495,8 +495,10 @@ static int s3c24xx_eint_init(struct sams return -ENODEV; eint_data = devm_kzalloc(dev, sizeof(*eint_data), GFP_KERNEL); - if (!eint_data) + if (!eint_data) { + of_node_put(eint_np); return -ENOMEM; + } eint_data->drvdata = d; @@ -508,12 +510,14 @@ static int s3c24xx_eint_init(struct sams irq = irq_of_parse_and_map(eint_np, i); if (!irq) { dev_err(dev, "failed to get wakeup EINT IRQ %d\n", i); + of_node_put(eint_np); return -ENXIO; } eint_data->parents[i] = irq; irq_set_chained_handler_and_data(irq, handlers[i], eint_data); } + of_node_put(eint_np); bank = d->pin_banks; for (i = 0; i < d->nr_banks; ++i, ++bank) {