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 961F83BD64D; Fri, 9 Oct 2026 14:40:32 +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=1791556834; cv=none; b=X+MzwsPK2jNot4bqvOwkcmMd4JlMAboFUVYmoEv8V5IdWYafgkhQkxJ+GYLueFdmdiFBddyPiS1qzpP9kFqPkzfFbl3hROorB/jNH1lG70/Pl0U3gcfxEjiq1zPkbTg39KzjqZXH65eyUrS2PwnN0oBTzlmETXsBctrk7UtqB2Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791556834; c=relaxed/simple; bh=j3mAe0nczySXWn4YY6l0kiho5KznIN+d6iYWKfx+NCw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hgqG+hhUtP0HW7fROp+thqalcD5Rs+O+l/5Qout+GlLxQHBwuyp17X71YTbhMzL+Y2CEOJCXoEzKKezQ0trtmnp569/LoofHKpwdciEp0PccaxK1uu7x/NTuMmJoJla38a+/dwvZe/XymgN703/+zeittjGmlXZrA2gej++PSYY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lmboNNZN; 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="lmboNNZN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E81D61F000FF; Fri, 9 Oct 2026 14:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791556832; bh=VQfXHEbaWutnn7MgCk/rGCfy41nNOb9VooHOWHmP2SQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lmboNNZN1gBgWSL6z6c40bbt/TP04+YRgCkC/uKfh6IBRj0n8Il7+TdJoZUK08KYh hTfRBcBTOCYdhrIJbVt/hfuAXvHNq/GXPPCA2GH6K2Ytlw2fSvgo4yr5Wq3wkfZenq SKqF/MKDbGzWcuT6iUirTTbu6X7TZLq2kv2C2pmM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Song Li , Fan Wu , Florian Fainelli Subject: [PATCH 7.2 249/428] serial: 8250_bcm7271: fix use-after-free in brcmuart_remove() Date: Fri, 9 Oct 2026 16:09:46 +0200 Message-ID: <20261009140951.576773766@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009140946.008206689@linuxfoundation.org> References: <20261009140946.008206689@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 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Fan Wu commit 189b9dc8c96ec9486482f27c1372b04a7152175e upstream. brcmuart_handle_irq() starts priv->hrt to work around a receive-timeout quirk of the 8250 core when hardware flow control is enabled; the timer callback brcmuart_hrtimer_func() dereferences priv. brcmuart_remove() cancels the hrtimer before it unregisters the port, so a receive-timeout interrupt that arrives in between re-arms the timer. After devm frees priv, the callback runs on freed memory. Unregister the port before cancelling the hrtimer. serial8250_unregister_port() shuts the port down and frees its IRQ, so brcmuart_handle_irq() can no longer restart the timer, and the final hrtimer_cancel() drains any timer that was armed before or during the unregister. This issue was found by an in-house static analysis tool. Fixes: 41a469482de2 ("serial: 8250: Add new 8250-core based Broadcom STB driver") Cc: stable@kernel.org Assisted-by: Codex:gpt-5.6 Co-developed-by: Song Li Signed-off-by: Song Li Signed-off-by: Fan Wu Reviewed-by: Florian Fainelli Link: https://patch.msgid.link/20260909084002.686911-1-fanwu01@zju.edu.cn Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_bcm7271.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/serial/8250/8250_bcm7271.c +++ b/drivers/tty/serial/8250/8250_bcm7271.c @@ -1123,8 +1123,8 @@ static void brcmuart_remove(struct platf struct brcmuart_priv *priv = platform_get_drvdata(pdev); debugfs_remove_recursive(priv->debugfs_dir); - hrtimer_cancel(&priv->hrt); serial8250_unregister_port(priv->line); + hrtimer_cancel(&priv->hrt); brcmuart_free_bufs(&pdev->dev, priv); if (priv->dma_enabled) brcmuart_arbitration(priv, 0);