From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D155C432C0 for ; Fri, 22 Nov 2019 11:12:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF4BC2070E for ; Fri, 22 Nov 2019 11:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574421175; bh=wxOmL7IPVisL9tNKCQ8v1irIg/JlK6orRS2rAjsOAy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=krne1KPEu/QCGMnmtmHVSdbTFnWKz9QXg9YsczWWykHa3kXb7uc7TfvANILyKvj5q pbnNG4m/o0ejOenTRq2R1JJe/VYobYzwr+Z+woFeZCQlT4uCTVm8a5avDH2/WHHuGO +XFqDMg2xVfdjl2bk4D39qDkx2VnUYjst67Mkhcs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728643AbfKVK4n (ORCPT ); Fri, 22 Nov 2019 05:56:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:44796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730109AbfKVK4k (ORCPT ); Fri, 22 Nov 2019 05:56:40 -0500 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 2D60D20715; Fri, 22 Nov 2019 10:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574420199; bh=wxOmL7IPVisL9tNKCQ8v1irIg/JlK6orRS2rAjsOAy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bmSdvbl9gSEYKPr/Jtxoh2tK8uOiPJ8L7xbtDyAh4nisE89tEHO7yyVbHG++sGhh8 inQF/vMV9BZeo/HCZ0Pt1JjoewJquq34Xusx+c/iuZyKl0ynRNCWNipizpCNwR5K66 BawGVX6eaamCdApmehCK4fNAvQ2P7b7r1VIY16lc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Jens Wiklander , Nobuhiro Iwamatsu Subject: [PATCH 4.19 003/220] tee: optee: add missing of_node_put after of_device_is_available Date: Fri, 22 Nov 2019 11:26:08 +0100 Message-Id: <20191122100912.931081612@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100912.732983531@linuxfoundation.org> References: <20191122100912.732983531@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Julia Lawall commit c7c0d8df0b94a67377555a550b8d66ee2ad2f4ed upstream. Add an of_node_put when a tested device node is not available. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ identifier f; local idexpression e; expression x; @@ e = f(...); ... when != of_node_put(e) when != x = e when != e = x when any if (<+...of_device_is_available(e)...+>) { ... when != of_node_put(e) ( return e; | + of_node_put(e); return ...; ) } // Fixes: db878f76b9ff ("tee: optee: take DT status property into account") Signed-off-by: Julia Lawall Signed-off-by: Jens Wiklander Cc: Nobuhiro Iwamatsu Signed-off-by: Greg Kroah-Hartman --- drivers/tee/optee/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/tee/optee/core.c +++ b/drivers/tee/optee/core.c @@ -696,8 +696,10 @@ static int __init optee_driver_init(void return -ENODEV; np = of_find_matching_node(fw_np, optee_match); - if (!np || !of_device_is_available(np)) + if (!np || !of_device_is_available(np)) { + of_node_put(np); return -ENODEV; + } optee = optee_probe(np); of_node_put(np);