Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9928387ybi; Wed, 24 Jul 2019 12:29:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQskN/sJK/hRuNamuhYGWrX0FYftIdBKYmf7CjZBXAPb7hCVb5R0GtVGiqyA/xWt1B10De X-Received: by 2002:a63:d002:: with SMTP id z2mr84951409pgf.364.1563996595569; Wed, 24 Jul 2019 12:29:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563996595; cv=none; d=google.com; s=arc-20160816; b=SZTqd05xo1HB2TMk6K+jmoQ+zk4V8DKh2lG5Sgl92N3bWRKPzNFuC8zBOqTa8AlkW2 V36XBznYEQlYtsX528zYnYwva8zzkxl2+daDMmTFuBNTsmmhJBI++aopg36edcgf7R6e ljkyx0O27jZG5+wHu8+dObFXDKHemASSAn9U2kHg5eBvkpnBjvRhfIGPvLqM1AHlffFB 8igwxLtI2/MR7ogem85JHQM6mvrKPGz6/R7+Xx4nywNDkGUsrP/DnFz6DzlknC3Uu/6A Z34sy7VT4N8FiubeSy7gDg9jngf0N9jIqKtBCIMDYzvrExNuK5Mx2adncs60i7ujmHD3 NKNA== 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=N1GHO0TbEEpLbuKp7Rt2Rz0Bkn1fTMCNy7hGvzGal2o=; b=yUdh3HZorPywv9Sd6ydOLMgZa8gVKKRxR7OyL9sCFXfSRVKQmpr36l9afKZZpFLX44 wDL4N+PVAEQveAeHplu6WyrHNLmlzlvzxOD4Eoxgr69TiQVJo3P7wm5CLvIf3jle04No uTBtju5nuW2rHPhmverezDvaC3wDNEgBcR0EIcFQ4+xNg0WypD/ivbwax/KJkyjBSeTm /vbiIJYZrcKuq/w/xMMBiAAxV4XrH9Yq2iaOWU4SbOU2DD3usNhV9RWLCSlR50eKsaIy uAAKagwgIGUkqrqqBdcZyKuRDWVJKPuv+R4escEulY9rFNZYsvVrbxjgpGwWejFNAa0R DOcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oZ7DqTIA; 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 x35si13069620pga.337.2019.07.24.12.29.40; Wed, 24 Jul 2019 12:29:55 -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; dkim=pass header.i=@kernel.org header.s=default header.b=oZ7DqTIA; 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 S2387908AbfGXTX7 (ORCPT + 99 others); Wed, 24 Jul 2019 15:23:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:39896 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387898AbfGXTX4 (ORCPT ); Wed, 24 Jul 2019 15:23:56 -0400 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 B2B18218F0; Wed, 24 Jul 2019 19:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996236; bh=w7VUb5FPr2CBplIfXrUWD0r0lOuMXnxsaKY/LNDz9mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZ7DqTIApveocwsscvpb1QvtoB5vpos5G32gBJkKDm4VV7OW9nApzYViN8xEi/b1k gMjTQqlTFjv+KixO7XS1avBhifZ94khwZYO5fY5btr/qwPtuzlU4ji2DAkDH6kVuWt CvLI0WLdP+96SzIITGYoRoI+ETytPCkDPlUbHO2Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Yang , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.2 027/413] media: venus: firmware: fix leaked of_node references Date: Wed, 24 Jul 2019 21:15:18 +0200 Message-Id: <20190724191737.420017002@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@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 [ Upstream commit 2c41cc0be07b5ee2f1167f41cd8a86fc5b53d82c ] The call to of_parse_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: drivers/media/platform/qcom/venus/firmware.c:90:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 82, but without a corresponding object release within this function. drivers/media/platform/qcom/venus/firmware.c:94:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 82, but without a corresponding object release within this function. drivers/media/platform/qcom/venus/firmware.c:128:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 82, but without a corresponding object release within this function. Signed-off-by: Wen Yang Acked-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/qcom/venus/firmware.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c index 1eba23409ff3..d3d1748a7ef6 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -78,11 +78,11 @@ static int venus_load_fw(struct venus_core *core, const char *fwname, ret = of_address_to_resource(node, 0, &r); if (ret) - return ret; + goto err_put_node; ret = request_firmware(&mdt, fwname, dev); if (ret < 0) - return ret; + goto err_put_node; fw_size = qcom_mdt_get_size(mdt); if (fw_size < 0) { @@ -116,6 +116,8 @@ static int venus_load_fw(struct venus_core *core, const char *fwname, memunmap(mem_va); err_release_fw: release_firmware(mdt); +err_put_node: + of_node_put(node); return ret; } -- 2.20.1