From nobody Thu Apr 9 23:25:01 2026 Received: from 8.mo561.mail-out.ovh.net (8.mo561.mail-out.ovh.net [87.98.172.249]) (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 060603A5E8E for ; Thu, 5 Mar 2026 13:57:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=87.98.172.249 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772719033; cv=none; b=jHTf2WMY6V7aiFVJRk8hS8a3l3ZJ16Mp+LZ3H5xQlB9Yr1w/0AbOpgScwVstD/fS24YtxVVSYsXaQ3DQmBIY3oSNgcLPgeRQPlyatTTvrrlQ2cdyhBwFam21f7crsBZECsEe+lSIr8I1sd+mH7kjW5gfou2HQtkCGVBXU77YJns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772719033; c=relaxed/simple; bh=tTjY5bp0iTm2WCvHOqhfSqQFJeTDlje+fkP7UD/PYN8=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=nO8VOFIh+HUMoY3bQoxAUP50/23EbNk5IhFN7s31p390emNUo1o70DkypfWd/1cOBzsREsRwMT44pwMdmQrXiPtbdKIgB7rv98GeuP3h6gWEN338jKhYt3SHR5UrnRZl2NFxBVLXtxOj9zZh07LaPhTFNnKtedbGKUL0Cwg3xfY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=m-works.net; spf=pass smtp.mailfrom=m-works.net; arc=none smtp.client-ip=87.98.172.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=m-works.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=m-works.net Received: from director10.ghost.mail-out.ovh.net (unknown [10.109.254.116]) by mo561.mail-out.ovh.net (Postfix) with ESMTP id 4fRTb50x1Tz5yV2 for ; Thu, 5 Mar 2026 12:37:53 +0000 (UTC) Received: from ghost-submission-7d8d68f679-wdjj2 (unknown [10.110.118.54]) by director10.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 5D555C284A; Thu, 5 Mar 2026 12:37:52 +0000 (UTC) Received: from m-works.net ([37.59.142.109]) by ghost-submission-7d8d68f679-wdjj2 with ESMTPSA id 6qY8OR95qWl+bhsArAFjuQ (envelope-from ); Thu, 05 Mar 2026 12:37:52 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-109S0032fe0d132-1f76-42ce-b129-39610cbfe1d1, E291CFBA5258997C937E8CA829FF8FA8CC2CB86B) smtp.auth=maciej.andrzejewski@m-works.net X-OVh-ClientIp: 85.232.250.78 Date: Thu, 5 Mar 2026 13:37:51 +0100 From: Maciej Andrzejewski ICEYE To: Peter Korsgaard , Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, maciej.andrzejewski@m-works.net Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Maciej Andrzejewski ICEYE Subject: [PATCH] serial: uartlite: fix PM runtime usage count underflow on probe Message-ID: <20260305123746.4152800-1-maciej.andrzejewski@m-works.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email 2.43.0 x-ovh-tracer-id: 8728257556967727907 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: dmFkZTE+BBN4ki3MZI6UJwwXPNXr7zQhdIUJFJhmPVn4bY1kqxTrnVqh3yPzi/yOrNJawXuQhB39ItU8158PVFKGLX2ZhRKSfN1qHtYtSL1ksSWLb4GHbJD/ofLRHtslEZCkIxKHauApY/5ia/qmyIFMzAo16R5zGVCFUA6c7gcqjo4kk9t+mawt/OgBmYCXpmV+EPnwzx2tiD8sVNkR7siUi9QHaKWeX6kIYA+zJQZBZZDa9l0NRJ+HxyoIDXNTT1HnDGg8NALUmMaDi0bezRsnyqaNwl8x0FicpK/DLGmZPgq5BUr0LoF1MynX2wZcm2G1gFUwvExcL/Lvelo9i/nfwmuaFT4ImvTaSkryFblMPG+H/LSoKukVOB9Mf/zAfvCD6zNcPB/oubKemo5RO8rNi90oFZyu0XNNMWo7aGOd5DaNtMje9RqQgTxUwFPpd+52UNQB/rsYsV57EIPeLgq+S3JnoELa/F1T0+s7aaUYN6RCvvRb8kYKmYdsUCAcQAGpux1SIjAAA/fVTGH54XDr6sxO8wwDPKIRGeTW5eYhyqalMxFkP0W8Nd+lkcx8gFd7e66C5A0bTS7TpbH4rzynLgbEI1nruYzMZQashAj5YufqFoMNT8pXD1tIotOOTTBbnVKrGIXq0jG+O5UZr8Xr4Fk8sJflxOP3T0dnJDLF244EBw Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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@vger.kernel.org Signed-off-by: Maciej Andrzejewski ICEYE --- drivers/tty/serial/uartlite.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index 39c1fd1ff9ce..6240c3d4dfd7 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -878,6 +878,7 @@ static int ulite_probe(struct platform_device *pdev) 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); =20 ret =3D ulite_assign(&pdev->dev, id, res->start, irq, pdata); --=20 2.43.0