From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9202E33B975; Thu, 2 Jul 2026 16:51:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783011087; cv=none; b=lqODIR/QDEvCZSWKCTtFajP5rJwXRcg1ZWiDhFlujPmp9hootljKtsBiOQQcl7ngozBRSOvvCQskf5uPq5YefZeMmYMNnffGl+ZzbUyrZ+QK4+XP+JtmIcHEDCQM+OHNSB/s/jSQYfw401yq4pPaCAPLLTLOtgv0PLFz+xxUPoM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783011087; c=relaxed/simple; bh=XCnQxaDkeEdTpJOjRSR6JTMTPIFeJbTc5Vkk9HwAUCM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o5V/HEPXn72u22ouVWuEJ+2BN3gA9h5Mm0O/cg8DymHrzSLVWEcGvOD2NWlWIQIwW/IGdxbnTLFtr44RNCuZ0BltElN6vetz8cKoHXOiJ3GwVfsnX2veKX9yTnGKlggJoxkZFgDmrN3klW9NoqHfJYu4fxyS5A0RiucRkJxuulQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LnKCO70B; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="LnKCO70B" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03AA31F00A3A; Thu, 2 Jul 2026 16:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1783011086; bh=g8pcysCsLfneAgPdzazwC+BbXlNboIWtdpc5wvvdj64=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LnKCO70Bvjj2AIPQdt9G6QcTY93KNp3cUPxChR0+LHaW+qKU2m/9MQkrmIla7hNhg OdLrZwZWrEmkWmPIfkej+R1PfOp9VkywsZDNVCssiwdekSuYY0rJUIamXeX8dBjQnn k8Nlg3eblzaTQS9Y/A+HG4XruopcCHvJpaIL6BUM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wentao Liang , Xu Yilun , Xu Yilun Subject: [PATCH 6.6 152/175] fpga: region: fix use-after-free in child_regions_with_firmware() Date: Thu, 2 Jul 2026 18:20:53 +0200 Message-ID: <20260702155119.002139680@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260702155115.766838875@linuxfoundation.org> References: <20260702155115.766838875@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wentao Liang commit 54f3c5643ec523a04b6ec0e7c19eb10f5ebebdd3 upstream. Move of_node_put(child_region) after the error print to avoid accessing freed memory when pr_err() references child_region. Fixes: 0fa20cdfcc1f ("fpga: fpga-region: device tree control for FPGA") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang [ Yilun: Fix the Fixes tag ] Reviewed-by: Xu Yilun Link: https://lore.kernel.org/r/20260408154534.404327-1-vulab@iscas.ac.cn Signed-off-by: Xu Yilun Signed-off-by: Greg Kroah-Hartman --- drivers/fpga/of-fpga-region.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/fpga/of-fpga-region.c +++ b/drivers/fpga/of-fpga-region.c @@ -168,11 +168,10 @@ static int child_regions_with_firmware(s fpga_region_of_match); } - of_node_put(child_region); - if (ret) pr_err("firmware-name not allowed in child FPGA region: %pOF", child_region); + of_node_put(child_region); return ret; }