From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 55D9A36F414; Mon, 23 Mar 2026 14:07:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274853; cv=none; b=QONuj60zfp64r6w554JYjWWc9DgRRyZ9n1lVhGeVGK8Gz3o0GPN06i4Fi+yU9uEEbg2TFJpg3QOdJwYRkuStmmgR/sjAxsmzNEQtkJJgVgN0VT8t3TqxR+hVm5LWQUziFGek/RQY/MfIqcdSrIQFk0cJi/z83/FGiwnidXypf7c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274853; c=relaxed/simple; bh=yuW3ZBaFCvGz+N7t9WASyaN5e0HKyqr2orBzcmDnp3Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KgZg6RLjKcZXWP0Bovx08IWqtztwfM0ORsJtR+43w+RnUkRLQ3VQrBjxGIOOJ0317xBMPTqoaHsOphxH4MveCgXgzFrks1LxYYPxT0dyNRI03aQOSg6nBE/6ghb5FlTegGmDgzaR7K5IvYTVeDNd7adnckzbST2+m2L4NZRxWyU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lYzu3r5b; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="lYzu3r5b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3C53C4CEF7; Mon, 23 Mar 2026 14:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774274853; bh=yuW3ZBaFCvGz+N7t9WASyaN5e0HKyqr2orBzcmDnp3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lYzu3r5bNYbc1BuSVPIOl7Jfa/9Bm+1QLRfR43IYXe0HFpdPIVF3NxRwQCzTR1opm QSFv1dYFRViM4O9SAXCeCI4xHTaBL8455dWTCZS/oA9v4CfBs6LRj8ZLbBNfIzJ/cp TBszy08derwEF2kA8oXP8k+vnajJu3K7KSbzI5Vg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Maciej Andrzejewski ICEYE Subject: [PATCH 6.18 078/212] serial: uartlite: fix PM runtime usage count underflow on probe Date: Mon, 23 Mar 2026 14:44:59 +0100 Message-ID: <20260323134506.226144263@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134503.770111826@linuxfoundation.org> References: <20260323134503.770111826@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maciej Andrzejewski ICEYE commit d54801cd509515f674a5aac1d3ea1401d2a05863 upstream. ulite_probe() calls pm_runtime_put_autosuspend() at the end of probe without holding a corresponding PM runtime reference for non-console ports. During ulite_assign(), uart_add_one_port() triggers uart_configure_port() which calls ulite_pm() via uart_change_pm(). For non-console ports, the UART core performs a balanced get/put cycle: uart_change_pm(ON) -> ulite_pm() -> pm_runtime_get_sync() +1 uart_change_pm(OFF) -> ulite_pm() -> pm_runtime_put_autosuspend() -1 This leaves no spare reference for the pm_runtime_put_autosuspend() at the end of probe. The PM runtime core prevents the count from actually going below zero, and instead triggers a "Runtime PM usage count underflow!" warning. For console ports the bug is masked: the UART core skips the uart_change_pm(OFF) call, so the UART core's unbalanced get happens to pair with probe's trailing put. Add pm_runtime_get_noresume() before pm_runtime_enable() to take an explicit probe-owned reference that the trailing pm_runtime_put_autosuspend() can release. This ensures a correct usage count regardless of whether the port is a console. Fixes: 5bbe10a6942d ("tty: serial: uartlite: Add runtime pm support") Cc: stable Signed-off-by: Maciej Andrzejewski ICEYE Link: https://patch.msgid.link/20260305123746.4152800-1-maciej.andrzejewski@m-works.net Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/uartlite.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -878,6 +878,7 @@ of_err: pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_set_autosuspend_delay(&pdev->dev, UART_AUTOSUSPEND_TIMEOUT); pm_runtime_set_active(&pdev->dev); + pm_runtime_get_noresume(&pdev->dev); pm_runtime_enable(&pdev->dev); ret = ulite_assign(&pdev->dev, id, res->start, irq, pdata);