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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 73C6EC27C79 for ; Mon, 17 Jun 2024 14:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PEZjeteQXfzQdcWVQrn0yV9Qj7kNGp+WUXl9yT7pJIM=; b=nTqviw6xI120xn1LhTKKOPELf4 0lstXAauLg56DXl34UV+chT9/R8qcDI/Rvbp4+P0PDSDIvGgbjo4hEj8AV/NPSXzeJIv/0N0RJJt0 TP7YiVTnK2pwMlQXUJb6PLW7ji019531y0oBvV//Mk1icTSMNMWrGO3sI5a6HnzKAoaEoZnQI0dj0 aSh5aFk0NTl4eV338p1BEK4i5KHRzoguFFex/z8XMslOgYP2oiUiVQLuX21/snxUfYVJfvYbWZQ/a 6IwjA9Ajceelgr0wWi2P4lBDM69EAkszdkSW9DznYpPJa7bNqxmjPVQE25SS7H9GyyQDBTUncvfjU 891288gg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJDYu-0000000BElR-2kjy; Mon, 17 Jun 2024 14:42:24 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJDYr-0000000BEk6-0pEL for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2024 14:42:23 +0000 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-37597eba356so17136455ab.2 for ; Mon, 17 Jun 2024 07:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718635339; x=1719240139; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=PEZjeteQXfzQdcWVQrn0yV9Qj7kNGp+WUXl9yT7pJIM=; b=xFAe8S1pDqnOPZeU5vzJ6M5+62Rx6DU2xOLMSf1Ip+vEN5nUMeNKdwQdjEbJxpN+v1 rbsT4D38rwY0cwfe+dft6AuUicCfV/5jYnsHLer/YYmdRbCBCiEpJjzoC8m9Cdwp4Gkf 3mNh1eDeRImvSYLxoFtvh55FTJQEED2Xuo/oV/gixdggKvfp3LSMzGFSD+UqysjoEvVR 2dXgMT2a8CMhYxdebms+tj3/LT1hw+Skq4Pz8iHg0geb29fn6eH7+6KcUYEUpAykK+Kj loghzl8jayV/IyfnMhpG4++3vKf417ZJQRecEhFGYBbbe0e1wvmd0RuPoqAl14Xvo1e9 biOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718635339; x=1719240139; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PEZjeteQXfzQdcWVQrn0yV9Qj7kNGp+WUXl9yT7pJIM=; b=FkpOWKyIcYLbM+dq5iFcfo28T8wFERkFFQsaPVG0f9gPxLTxbfOidC322oIciuZRmG Ol3QprvsXjEJHNLsjiJfhXlSG932/RJ1Vu4vvq0fyzRILnFx9IMqpfWXN6LW6E8IClEC TUVifi4LNU4eXHKIbn8+ztjEq4EuKLHUJLimenURYhv6F5zXz+cLTgIxGUr7OvMDhEVf txuqBQSFfow/bYHt8NE5mhWDCNmxutoyER4kxdPe0ijoIGrsWrX3yDZe9mEVlgF3+Thy 2VfvmAxkAv0PoZJkd7blAraL6HavjjTga1IrrL/HsnC2pp+zQS8Rl6Eqb6dbin90l/6m MiEg== X-Forwarded-Encrypted: i=1; AJvYcCXDQC5HVbcagI9rDCFAx5mRuGmKsVKPDPNERnYr2kH/78eUEaP6E/iEdZ5WiRo4M2/F4ixpkwYxrM9NJbRPYEEQqPitO1/wE29i0/2z+zH6jb0tXQc= X-Gm-Message-State: AOJu0YydMK+WNWB5J89RWiwuW0T12i+q0VxyKQYVHMpOjRg8yxrkZZKF k0c6P7U9+zBiBEh8KPA+8a1U9+fmSvyu+LStTR8bLrjekx/nurd2GBG0IzNDB28= X-Google-Smtp-Source: AGHT+IEYXBLlZaTCF/KozlYWXmX+1dC92NpMDk5cKK1l7LyVT2phM7sLrhcf7MZdinEAwBHySA2uwA== X-Received: by 2002:a05:6e02:152e:b0:374:8928:83a4 with SMTP id e9e14a558f8ab-375e0e30792mr118277925ab.14.1718635339363; Mon, 17 Jun 2024 07:42:19 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:e681:7328:24ae:62a]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6fede16ad2fsm6720686a12.32.2024.06.17.07.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 07:42:18 -0700 (PDT) Date: Mon, 17 Jun 2024 08:42:16 -0600 From: Mathieu Poirier To: Aleksandr Mishin Cc: Peng Fan , Bjorn Andersson , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , linux-remoteproc@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, stable@vger.kernel.org Subject: Re: [PATCH] remoteproc: imx_rproc: Fix refcount mistake in imx_rproc_addr_init Message-ID: References: <20240612131714.12907-1-amishin@t-argos.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240612131714.12907-1-amishin@t-argos.ru> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240617_074221_313663_E26C10BD X-CRM114-Status: GOOD ( 18.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jun 12, 2024 at 04:17:14PM +0300, Aleksandr Mishin wrote: > In imx_rproc_addr_init() strcmp() is performed over the node after the > of_node_put() is performed over it. > Fix this error by moving of_node_put() calls. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: 5e4c1243071d ("remoteproc: imx_rproc: support remote cores booted before Linux Kernel") > Cc: stable@vger.kernel.org > Signed-off-by: Aleksandr Mishin > --- > drivers/remoteproc/imx_rproc.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > Applied. Thanks, Mathieu > diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c > index 39eacd90af14..144c8e9a642e 100644 > --- a/drivers/remoteproc/imx_rproc.c > +++ b/drivers/remoteproc/imx_rproc.c > @@ -734,25 +734,29 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, > continue; > } > err = of_address_to_resource(node, 0, &res); > - of_node_put(node); > if (err) { > dev_err(dev, "unable to resolve memory region\n"); > + of_node_put(node); > return err; > } > > - if (b >= IMX_RPROC_MEM_MAX) > + if (b >= IMX_RPROC_MEM_MAX) { > + of_node_put(node); > break; > + } > > /* Not use resource version, because we might share region */ > priv->mem[b].cpu_addr = devm_ioremap_wc(&pdev->dev, res.start, resource_size(&res)); > if (!priv->mem[b].cpu_addr) { > dev_err(dev, "failed to remap %pr\n", &res); > + of_node_put(node); > return -ENOMEM; > } > priv->mem[b].sys_addr = res.start; > priv->mem[b].size = resource_size(&res); > if (!strcmp(node->name, "rsc-table")) > priv->rsc_table = priv->mem[b].cpu_addr; > + of_node_put(node); > b++; > } > > -- > 2.30.2 > >