Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1369867imm; Tue, 2 Oct 2018 07:12:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV63mWTjW1BgDHUzoAGpYbHki/IoXhwjCvsPfOeuY9rC3GccQN+IDeRh6wiBhOtag34UFhyRk X-Received: by 2002:a17:902:6b83:: with SMTP id p3-v6mr6496598plk.24.1538489561799; Tue, 02 Oct 2018 07:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538489561; cv=none; d=google.com; s=arc-20160816; b=J6ZXUZhWd92VYONkXVe8eRKiNyXsRIKNY5V4T26bI0O3esCfoGho9GS8KTDla/Q/im l88QJyhSWLeInV8EHB5psmY/Tav6CGSLlPfdZj2Fltuywyzg137rHQG3CFYepYVbDfFm UeeCkQXaHUmaXGso607Eey3lbUXpwVgLnJfEx2b+rBHaI6SWPz1Ncmnwtv5WX1aaKcQg HlkmNzILDnd06k+wce+r3LKCPV8K4ChETFkgLxUbDdJyj8noFT6XllCfzMjhPY30LVgG CoHn54miURvOymUXDIp/cppXLZBBHi90rSo5MVkCMSR4f2GksIUmClKcCcpasxKuNO8i oiWw== 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; bh=zAzxKwyPf4Vq9RyZKs85TNSWP+5X8A8t0dAAuqjH5vg=; b=R4V4IocmxbdSXV01/L3lWuBezBE1NhSn54F3Zy9ic3efNemJM7oa6GKelQH4C/DTr1 QIqbtuA3AyxbI/PH7Xhs7fQRghrw2l433Aq2o86z0JNS4N+Ho2Mg7WEKA1FgxgGEmaoB XrS0XBmB7pePJxBT5sxNdmWSDnVF8QRxnvCV51tg0stEPe4VJ75oVdd0F8e5/xMmWbe1 rHiN1qmBlt2lFsO3Mvyb6Bx+fMnCZjBslM4gally7kNrU3ppqf9AZHNUTHqkpZIu/I9p Nx0cfklzBiuQX8N4nT27il+0TcZ6V87sZaFqxvIWJjLnqV+OFN9nHwYbcniFHic2063S kivA== 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 p184-v6si14851456pga.536.2018.10.02.07.12.25; Tue, 02 Oct 2018 07:12:41 -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; 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 S1728640AbeJBUK4 (ORCPT + 99 others); Tue, 2 Oct 2018 16:10:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60380 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728109AbeJBUK4 (ORCPT ); Tue, 2 Oct 2018 16:10:56 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6E0B6B2F; Tue, 2 Oct 2018 13:27:34 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Mc Guire , Takashi Iwai , Sasha Levin Subject: [PATCH 4.18 065/228] ALSA: snd-aoa: add of_node_put() in error path Date: Tue, 2 Oct 2018 06:22:42 -0700 Message-Id: <20181002132503.681051901@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132459.032960735@linuxfoundation.org> References: <20181002132459.032960735@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Mc Guire [ Upstream commit 222bce5eb88d1af656419db04bcd84b2419fb900 ] Both calls to of_find_node_by_name() and of_get_next_child() return a node pointer with refcount incremented thus it must be explicidly decremented here after the last usage. As we are assured to have a refcounted np either from the initial of_find_node_by_name(NULL, name); or from the of_get_next_child(gpio, np) in the while loop if we reached the error code path below, an x of_node_put(np) is needed. Signed-off-by: Nicholas Mc Guire Fixes: commit f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa") Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- sound/aoa/core/gpio-feature.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/sound/aoa/core/gpio-feature.c +++ b/sound/aoa/core/gpio-feature.c @@ -88,8 +88,10 @@ static struct device_node *get_gpio(char } reg = of_get_property(np, "reg", NULL); - if (!reg) + if (!reg) { + of_node_put(np); return NULL; + } *gpioptr = *reg;