Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp625938iog; Mon, 13 Jun 2022 09:23:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzR5ZXOI9IWBbO5x8WJYt9IrrPGvIoUDsJQ5yLfsk2Rkw8bZ0mTkuPyaweaG4E3jzr27rAW X-Received: by 2002:a17:90b:4d90:b0:1e3:3025:66fe with SMTP id oj16-20020a17090b4d9000b001e3302566femr16584613pjb.145.1655137419538; Mon, 13 Jun 2022 09:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655137419; cv=none; d=google.com; s=arc-20160816; b=hq4JUE9bomtCyj7LqSxWR2GaumWSdyo4vxsuwN0ztNg9cwPUD7u1aocvTFt1tSaOkL iJSQXue68bZdzPwioad/KSyvmVMX+DYr9ywlF6k5URxaM1heVWAzgvvQFIfU8H5LTOYa JXQln8gFUYPTImEhyaMYNg0KW8xX+7lbCuTIOKuesg3/57QZjG75BzT1umrKoYCYfOWt VOSCkDUIvFfc1Y5trZomg5yYOFcixAoypUKsHw5h2tX9fCz6btTKs5tRkjzl2jiotp3J 0NWmi6Xteho4gAezRb6/DjjCXeaSs0LKOwiiwkNITMdI0ji0XDkC7E7VZjFphS5c74On N0GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YEv+cM0m22nOWELNzjBpfyHh3ZOAGmutK1qLifZISVw=; b=QRJrcBFLZxh+ALtiT+zR1yDPurgFwOtHqxibs05N2CfnqgRQTHFIoILEdQS7E37GOw d5cr6272d/cGU9FVGDcU+tgMnvz75yNzL+nCQnz+5jJhlF31T+8+q8M6NivAic6ns8Hi 0NV/gZslftJL/s2HZmXHtcfQbDtmzhlw9qjPOOXEeN6zq+N9+OHtGd4rhSTSPJP6zzuA wNLCtqO/4PdwPG1/DCFqQW17MJgwFeDk7F7hCiW9vsD2GsQq8OynqTVOTR85zuaVFIAE lFORAmokIMVzzCevmGce2LPO81LkKzA+qE0xLxn80uSPYvfj4niiJkKFNYTtHBfxKBY4 bhig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K+JuXegm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z28-20020a630a5c000000b003fe49e8de38si11332286pgk.409.2022.06.13.09.23.20; Mon, 13 Jun 2022 09:23:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K+JuXegm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355770AbiFMLjh (ORCPT + 99 others); Mon, 13 Jun 2022 07:39:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355157AbiFMLat (ORCPT ); Mon, 13 Jun 2022 07:30:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 426B641335; Mon, 13 Jun 2022 03:46:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 01ECFB80D3B; Mon, 13 Jun 2022 10:46:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B9ECC34114; Mon, 13 Jun 2022 10:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655117193; bh=0+3cOnk2z3C+1fmNZLPemFHmvE1ZEFxh/Sv4oC37mqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+JuXegmVMiJmUn6lXPrx8tDTD0c04sX7lnrPWqVD9q3hdZObSUAXRc8g527ZosAe wiVa916vAIjKrcqh5vz+vKfzNSWgHXiXNr1sTfeDalmpTtSoLQ6Peqy5mQ1qZ0VI/C PpnrwDJOSNcaiw2yJCrs/xb3UVo2cTWPNH2yMxeA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 5.4 319/411] watchdog: ts4800_wdt: Fix refcount leak in ts4800_wdt_probe Date: Mon, 13 Jun 2022 12:09:52 +0200 Message-Id: <20220613094938.303388610@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaoqian Lin [ Upstream commit 5d24df3d690809952528e7a19a43d84bc5b99d44 ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() in some error paths. Fixes: bf9006399939 ("watchdog: ts4800: add driver for TS-4800 watchdog") Signed-off-by: Miaoqian Lin Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220511114203.47420-1-linmq006@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/ts4800_wdt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c index c137ad2bd5c3..0ea554c7cda5 100644 --- a/drivers/watchdog/ts4800_wdt.c +++ b/drivers/watchdog/ts4800_wdt.c @@ -125,13 +125,16 @@ static int ts4800_wdt_probe(struct platform_device *pdev) ret = of_property_read_u32_index(np, "syscon", 1, ®); if (ret < 0) { dev_err(dev, "no offset in syscon\n"); + of_node_put(syscon_np); return ret; } /* allocate memory for watchdog struct */ wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); - if (!wdt) + if (!wdt) { + of_node_put(syscon_np); return -ENOMEM; + } /* set regmap and offset to know where to write */ wdt->feed_offset = reg; -- 2.35.1