Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp444333iog; Mon, 13 Jun 2022 06:07:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVeyRoKU497Ip5RwSmbrpyeHpsj2IeJn7YrZ31P+5wJ3c+/yXBNfAmbBCFeBVD6oyglhpr X-Received: by 2002:a62:e116:0:b0:51b:c452:47e6 with SMTP id q22-20020a62e116000000b0051bc45247e6mr59460651pfh.25.1655125646880; Mon, 13 Jun 2022 06:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125646; cv=none; d=google.com; s=arc-20160816; b=zP5IbruVjiGf/6OaTcj8S8BgMNt6WM1PKFKxcfFfR6QTimNSa77uIMtZVcY0AWxb5T 3kYFzzNnHXt0ypIjDk2aFZWf5rTguXgnfWV1sH2AXY8XNjRC/KlyyxWlZjy4SwNeh5nA va9QURMbQWVvkEJJid7mdhuWhhEMkEC/Ak3Xem7ljr1mr6qni26oqFe0gt3DGa9k+Xgz Rzxf9KHdSsekOz+LXCPLp+6jhh2lePzr7Q+1VONyQVaduWW4IlHR8saorRoZ++IC3Iof jPwVTnp0pnJ6W7iuRp9ZMf3hh6Y0wHp9kEcLLU53NsmZt6LJ+BlmmzPUySz7Pcnp/BUx xFHg== 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=CpTGRlsEa5jL/0cBjU5l1Ab4dZmYNHAbu+l2vmr/B8o=; b=CyZieQ/GqlJV721GSBbOneEvjiQpAsyLfot2Y3jhpmhiF167MVP6qvoMLAoysymBLG aiuqx7VF1ucBObYnidjA8VjGUsKt3Nco9niLf6QS9kEBTuftA+s5KTGONCwt8rjuIFLm IpyBH29bFOPpto1jmt/Mk05s5xiTBbKoo1gkYnVi6kCQfpFjmvp+RIeXmvtKecNWQ+Aq sl926pUcRr1BXc/bKZepk63hPHG5hrGp/I5kB9+XXRhVKPlsDHplQmPl0AmZMhMu/lKM maovFbMkekwD4GejuMs2ynJVIRAofUK0woLmYIdcKhaP5XDjROWMcwU601sMHkZ0UWtS OSYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vGhwJOW2; 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 b7-20020a170902d50700b00163bad6ec7bsi10351013plg.613.2022.06.13.06.07.11; Mon, 13 Jun 2022 06:07:26 -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=vGhwJOW2; 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 S240506AbiFMKcF (ORCPT + 99 others); Mon, 13 Jun 2022 06:32:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244936AbiFMK1w (ORCPT ); Mon, 13 Jun 2022 06:27:52 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F101A24BC0; Mon, 13 Jun 2022 03:20:05 -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 sin.source.kernel.org (Postfix) with ESMTPS id 0E499CE116D; Mon, 13 Jun 2022 10:20:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB83FC3411C; Mon, 13 Jun 2022 10:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655115602; bh=Q6MnP3vhr8WFw3WgNXSDoC26L+efmEjpQAEATFrNwyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vGhwJOW2BkzVAslyweIwzkU3ZKeye0cGgAqmCT4tUx0/F+Xxe3b8cCnV9K6NTg02T iwB4FVaYwV1Qd5QYDo48k8I5E96wUxdKRQGqHju+xDPB9MJyqWXLh1hKzrh7j0gd8Z F5rY+czqAXKTwft90EBqM4jSfM5aEgkh6tEhVSFY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Sergey Shtylyov , Damien Le Moal , Sasha Levin Subject: [PATCH 4.9 133/167] ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe Date: Mon, 13 Jun 2022 12:10:07 +0200 Message-Id: <20220613094912.063936642@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094840.720778945@linuxfoundation.org> References: <20220613094840.720778945@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 10d6bdf532902be1d8aa5900b3c03c5671612aa2 ] of_find_device_by_node() takes reference, we should use put_device() to release it when not need anymore. Add missing put_device() to avoid refcount leak. Fixes: 43f01da0f279 ("MIPS/OCTEON/ata: Convert pata_octeon_cf.c to use device tree.") Signed-off-by: Miaoqian Lin Reviewed-by: Sergey Shtylyov Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- drivers/ata/pata_octeon_cf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c index 7e6359e32ab6..fb07d16a9f2a 100644 --- a/drivers/ata/pata_octeon_cf.c +++ b/drivers/ata/pata_octeon_cf.c @@ -898,12 +898,14 @@ static int octeon_cf_probe(struct platform_device *pdev) int i; res_dma = platform_get_resource(dma_dev, IORESOURCE_MEM, 0); if (!res_dma) { + put_device(&dma_dev->dev); of_node_put(dma_node); return -EINVAL; } cf_port->dma_base = (u64)devm_ioremap_nocache(&pdev->dev, res_dma->start, resource_size(res_dma)); if (!cf_port->dma_base) { + put_device(&dma_dev->dev); of_node_put(dma_node); return -EINVAL; } @@ -913,6 +915,7 @@ static int octeon_cf_probe(struct platform_device *pdev) irq = i; irq_handler = octeon_cf_interrupt; } + put_device(&dma_dev->dev); } of_node_put(dma_node); } -- 2.35.1