Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1821303ioo; Mon, 23 May 2022 04:13:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxccN5YuWikpTWefk9kfnJgF7N2Y2oEBA0ZuGQ9ZCuRD8VQjxdzMgW7V7D042S93CAk80or X-Received: by 2002:a17:90b:4c0a:b0:1dc:e81a:f0c with SMTP id na10-20020a17090b4c0a00b001dce81a0f0cmr26301492pjb.2.1653304408802; Mon, 23 May 2022 04:13:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653304408; cv=none; d=google.com; s=arc-20160816; b=QKGXruEhbyjUO9tWKBlvHbU1dOUPgE0juUVe6ElZHZLthsEZZXodMaNvwkiw2TwXHR bRJgaGrWQYUcNhNqSxsJS57eYOvIySP1O6Y0u4eraTMYff2lfgIVnC3+n0KZlPHp5xO0 9pReFEjILmII5pd0O7gXiMNkAptD5S8m3xuuC8vuQtOOVvqt5i3BggWgOnZyqGVk1vdo 3C1APQPovEG4i2rMVMSLyBuCJQtzmBXrkXWfqwIBaI7iblMIpjc12p9OZrZYBLZXAYLw RlR+ZpoPcZ6qowWatYfaXB+XSJ15kPl4I6666XZp9kCZ/7J1MvrM3Be+OR9iyibc+vl/ TeJw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=UHS/1H01y880FAOLumjFQUSmGq2wt4Kc1CYUuYq+T+8=; b=kk8hhSXCPKN6uQvdrgOr+/MgoKR8+jZ12MZ485sPCbBlXQKXpqiGkJGZN+j1KKctD8 0Hff4bvWmg3tYvCW3H3C6gPzQnPlDDJ27KhClgD1pao00nxoyf95NRuL2GnT+R4Z3hkg zTrdQPPqbTyEWs+kcfq19l3hAXzclOVV99sjLUb1ei5r+FT2YADShp5iECcJq+hHfRTZ BsL1YkAlF2/eXxi7dYrkr4Rs1Pt0C8/uW9tBF7jLfToEBcFtfAOAi1FM2ncJ0M+o1nhS 7VYiIUglVFPsvBJJooJhIwyP2fxrqPRy5RAorcfxFUiQFEAx/flTgO6+M/rrf7pbsif1 0T3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="M/kmIjoI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h6-20020a170902704600b0015d0062ecc6si8842695plt.228.2022.05.23.04.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 04:13:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="M/kmIjoI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 92D251116D; Mon, 23 May 2022 04:11:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234540AbiEWLL2 (ORCPT + 99 others); Mon, 23 May 2022 07:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234522AbiEWLLX (ORCPT ); Mon, 23 May 2022 07:11:23 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 062735FE0 for ; Mon, 23 May 2022 04:11:22 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id r71so13418785pgr.0 for ; Mon, 23 May 2022 04:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UHS/1H01y880FAOLumjFQUSmGq2wt4Kc1CYUuYq+T+8=; b=M/kmIjoIH0HE5rSxdyUKmWN4nvj6jHeeKirmX0XfOYKQUtn0crCZuLzdb/jUkOEUaz jHmCO547LSP9WmMHp4mz5E9lQSWZr4sX1Fx2H1Vo9CjLcbazk9eH+lecXlB06x6TgEkT AsNAoYQw2oXyJxBUdgsQ9G3GVNJv5KFoaLG80u3PiKx7mocClDrL+p1MkSD8GxUwJMH0 XclhbhES7tfdxt4pg57V97uXXHqsdaJQ8TWU25sJ8Uw1yUwFBmzt1dBlc4q9aNodaiQl Cgo6VIa4W00mkLW6LiDaq8r+L9d6y58rbDF+S2PHtjbqSpcL1fwMVs0pMRYI7m8L4Q1g AImw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UHS/1H01y880FAOLumjFQUSmGq2wt4Kc1CYUuYq+T+8=; b=8RBXonoO2RZt7UMNeVUOu55DwDlTurNT9tGHCGCqtdMBtkEkf9OQ1uQmI11Baf3hkd cjYYFpwAyoGCpPnv1lQ/k5gc02BPXcaxdvstHoEotUwxBdNVmZa53Bv9nd8ljAqh8WLP OPsH+lyhtKIaXaKqAgKWsY5ZqVr6LQ29e4D1XIFpGrFo9LKMyODfI+IEAunIrvouaL0Z kvWH8CQ7gpeTrTbQzNp9HT2TAL4GSuLxJLc4xrkyZ6LKqPrFYEDwWtCbuq/sHOeT+a2p j1VIhHtgQ34+EFCSEUy/HvGE1iNhJprHB5kJ0OlhaUMOTYPgGlDTtCm+tpKp+22X14Pd Buhw== X-Gm-Message-State: AOAM530/SnYoXPtez/Md9c405dXGHHfM5kkigeSUslXbYsssRWf0+Kft SxxlOkvnaUcVPHuiRV64im4= X-Received: by 2002:a63:2b11:0:b0:3f6:5f7f:9e67 with SMTP id r17-20020a632b11000000b003f65f7f9e67mr15842513pgr.492.1653304281479; Mon, 23 May 2022 04:11:21 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id i11-20020a1709026acb00b001617ffc6d25sm4878253plt.19.2022.05.23.04.11.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 04:11:20 -0700 (PDT) From: cgel.zte@gmail.com X-Google-Original-From: chi.minghao@zte.com.cn To: sudeep.holla@arm.com Cc: cristian.marussi@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Minghao Chi , Zeal Robot Subject: [PATCH] firmware: arm_scmi: Avoid leak OF node on error Date: Mon, 23 May 2022 11:11:16 +0000 Message-Id: <20220523111116.2898-1-chi.minghao@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: Minghao Chi The OF node should be put before returning error in smc_chan_available(), otherwise node's refcount will be leaked. Reported-by: Zeal Robot Signed-off-by: Minghao Chi --- drivers/firmware/arm_scmi/smc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c index 745acfdd0b3d..43018be70edc 100644 --- a/drivers/firmware/arm_scmi/smc.c +++ b/drivers/firmware/arm_scmi/smc.c @@ -55,10 +55,10 @@ static irqreturn_t smc_msg_done_isr(int irq, void *data) static bool smc_chan_available(struct device *dev, int idx) { struct device_node *np = of_parse_phandle(dev->of_node, "shmem", 0); + of_node_put(np); if (!np) return false; - of_node_put(np); return true; } -- 2.25.1