From patchwork Sun Jun 5 07:07:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqian Lin X-Patchwork-Id: 1638982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=wq7qs2KX; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=iR5Gf7A2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LG74t1Yjwz9s2R for ; Sun, 5 Jun 2022 17:08:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=NX1x6teJdfRsEp5OpQ8lk1BhR49TuCylo0BB4Ozqpo0=; b=wq7qs2KXh45G0u sseQibsG6FuFaGoZD4sdwkfQMCdIX1JmbzXsPQNEBIkomd6WMrkcbyJpdz42jpK1TBnIgzB2Kj1OI pogM/e5pT4z5PA4tFWgrzjbz8BwgVb7FPElhPD23ELZnwYsg7EimDBWnf/Io8JKFzsDfsfZ8CIo9U x9zyo4+771WI6nrc1xzm0lxphU8RP4COxjX0LxZFFNJ2M+rBquWlmwNZkh0UyvibouSzFWQ7NCliT eV5tVF/o4qLakv9XGCZCT+iWHurfcgOMNdA1V4QAQOEnaQJd1K5nc9Stq2gQyH7BwZ+kl8+v/o9K2 YCyWcGHwV3IikYvDBaBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nxkMN-00Dsl7-In; Sun, 05 Jun 2022 07:07:39 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nxkMK-00Dskf-OV for linux-mtd@lists.infradead.org; Sun, 05 Jun 2022 07:07:37 +0000 Received: by mail-pj1-x102c.google.com with SMTP id l7-20020a17090aaa8700b001dd1a5b9965so10226106pjq.2 for ; Sun, 05 Jun 2022 00:07:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=IXhtIIwrHhpC545+iRgGHYieqqcWvvqmIcwI7xt4Nsk=; b=iR5Gf7A2/kjLk8Exxps3G0dFRVC1OZjJzS+j2VngWMWquMTrT0tMlu+kwyY+F7EMMI lGoZzbndHfDZ4cObymGJCKclk4t2eUSMdCQReDhUxzX4pRTRhUECii4OdVqCZo7/MLRv syITFdMzOJw61554abpUPmNjaYgNN1bo4ZoAP1ymyoWSietZE/1pr3cfS252SQh558kG qEFZLPguUBe4DBV/fZx4ZTTdbY5aE4vCY3KgmuQJB+9LM1igdu3RLOoRkqSbocJiCNdC b7+HeRs4HzS5LATNdkmXyFN/8d0xEiEYUFaV1hSLyycfFxdH5gv+B3pf1d5C3OcMs9YS PU2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=IXhtIIwrHhpC545+iRgGHYieqqcWvvqmIcwI7xt4Nsk=; b=DgaoakJMaTGlHJlksNyx4q8NwHgVAlJpKkEl9Zjhl0npKA1xBN2yn/tCH3cLekjARm tg0OmXUF+AdynmJxaGQJHAKJxy490xhaQEicWmCnED5LjPondTt/krZxJjn4hIsRcVfP j6sYCQbNxg14pmPlP5dWee//5rdWOX0oYZT8h4EyZVAlAAdOylyc8T9UW+mFxVgYonT9 wKsOmOthzdruIUXqeecZIxoVFqVtg4d/pciEsEdFDNdtTP+6jyMfCJNw1H27aBScPd6Z 71FAnEWBRvwy4GUP1SjGsznQrxU0jn3O3YNhTgJtDigy0/s5+ivKYW+dZcVNjoyvA47n Ex6Q== X-Gm-Message-State: AOAM533UTgYLr4/89JDG9k0h8r0TOVk0H2LhYytT4Rue0NT3I7hCZiJy QCVp3zd7oFs10ItTyxpQ+Q8= X-Google-Smtp-Source: ABdhPJyMTGLeCNNm+FCrSgXi3l1iw0Qz5IzzU1+Oa/PBBWrms0PoJZlcnhW8wVTcnShhAvR8SNJp+Q== X-Received: by 2002:a17:903:210a:b0:167:78c0:dd70 with SMTP id o10-20020a170903210a00b0016778c0dd70mr700900ple.157.1654412854448; Sun, 05 Jun 2022 00:07:34 -0700 (PDT) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id x28-20020aa78f1c000000b0050dc7628196sm442504pfr.112.2022.06.05.00.07.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 00:07:33 -0700 (PDT) From: Miaoqian Lin To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Miaoqian Lin , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mtd: parsers: ofpart: Fix refcount leak in bcm4908_partitions_fw_offset Date: Sun, 5 Jun 2022 11:07:23 +0400 Message-Id: <20220605070726.5979-1-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220605_000736_833242_A7AEBAD6 X-CRM114-Status: GOOD ( 10.39 ) X-Spam-Score: 0.1 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: of_find_node_by_path() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: bb17230c61a6 ("mtd: parsers: ofpart: support BCM4908 fixed partitions") Signed-off-by: Miaoqian Lin --- drivers/mtd/parsers/ofpart_bcm4908.c | 3 +++ 1 file changed, 3 insertions(+) Content analysis details: (0.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:102c listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [linmq006[at]gmail.com] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [linmq006[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org of_find_node_by_path() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: bb17230c61a6 ("mtd: parsers: ofpart: support BCM4908 fixed partitions") Signed-off-by: Miaoqian Lin --- drivers/mtd/parsers/ofpart_bcm4908.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/parsers/ofpart_bcm4908.c b/drivers/mtd/parsers/ofpart_bcm4908.c index 0eddef4c198e..bb072a0940e4 100644 --- a/drivers/mtd/parsers/ofpart_bcm4908.c +++ b/drivers/mtd/parsers/ofpart_bcm4908.c @@ -35,12 +35,15 @@ static long long bcm4908_partitions_fw_offset(void) err = kstrtoul(s + len + 1, 0, &offset); if (err) { pr_err("failed to parse %s\n", s + len + 1); + of_node_put(root); return err; } + of_node_put(root); return offset << 10; } + of_node_put(root); return -ENOENT; }