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 81D6533AD9B; Tue, 16 Jun 2026 16:58:25 +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=1781629106; cv=none; b=c+grWkoaIeelCOV37BczhnaGMV+K1h4BJcYduydvJNbYEg9ml5KoDpsq6UFjWmbAwvH9mioMeVB5BFmr+SLOuhkqKBSRm+JyB9rc6YAkcxIRSeroebAW9JtTx4HZich7x3juVgFGQ2HIKgdfKX3WLe656yyG4yHxHmjz3o19UnU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781629106; c=relaxed/simple; bh=j2Esxb0GJkg990F5mMfvOsxfS1oy0DgqujgQiBRsnWA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KSjrH7cnF++V6MiO3cX7E8nl4lY9zj2K8+3dmZ5X7BZXk1o61atauql7DXBPoKfp/FRQdfJLSD0urp19SB8jltgOd9lfamwYz13dWd4nns6OqX/spGxRDLIuuKpNpzu/Cb9SBWh8gEZDdo9MnMg34R79WXqj9XrbtJO6vP5qFsM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1MxY0bvr; 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="1MxY0bvr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 308621F000E9; Tue, 16 Jun 2026 16:58:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781629105; bh=IeEXgRFqVFPm8kT0hg+U3KvSNqEv57ofmrmIGbReSoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1MxY0bvrafdsv17vC3zP+GOBVG9NHd0qaRxMR83jVy8W+JsSjhxT/YNhfky1v3pX8 xD2uFiZj4LwShpbP/KM5AMY82iMYoEzG77O3VqEGnMr6MJ/8dYYYME1tO1M94BGe5W TpUURHNgT8kmpjiUGn4+ZzGxCuciZvnbqYqAkKGs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Ijae Kim , Myeonghun Pak Subject: [PATCH 6.6 180/452] serial: altera_jtaguart: handle uart_add_one_port() failures Date: Tue, 16 Jun 2026 20:26:47 +0530 Message-ID: <20260616145127.316664532@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145117.796205997@linuxfoundation.org> References: <20260616145117.796205997@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: Myeonghun Pak commit ea66be25f0e934f49d24cd0c5845d13cdba3520b upstream. altera_jtaguart_probe() maps the register window before registering the UART port, but it ignores failures from uart_add_one_port(). If port registration fails, probe still returns success and the mapping remains live until a later remove path that is not part of probe failure cleanup. Return the uart_add_one_port() error and unmap the register window on that failure path. This issue was identified during our ongoing static-analysis research while reviewing kernel code. Fixes: 5bcd601049c6 ("serial: Add driver for the Altera JTAG UART") Cc: stable Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak Link: https://patch.msgid.link/20260512065837.79528-1-mhun512@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/altera_jtaguart.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/tty/serial/altera_jtaguart.c +++ b/drivers/tty/serial/altera_jtaguart.c @@ -381,6 +381,7 @@ static int altera_jtaguart_probe(struct struct resource *res_mem; int i = pdev->id; int irq; + int ret; /* -1 emphasizes that the platform must have one port, no .N suffix */ if (i == -1) @@ -420,7 +421,11 @@ static int altera_jtaguart_probe(struct port->flags = UPF_BOOT_AUTOCONF; port->dev = &pdev->dev; - uart_add_one_port(&altera_jtaguart_driver, port); + ret = uart_add_one_port(&altera_jtaguart_driver, port); + if (ret) { + iounmap(port->membase); + return ret; + } return 0; }