[PATCH] wifi: libertas: fix runtime PM leak in if_sdio_power_restore()

Zhao Feng zhaofeng2 at cmss.chinamobile.com
Sun Nov 8 22:26:49 PST 2026


if_sdio_power_restore() takes a runtime PM reference with
pm_runtime_get_sync() to keep the card powered, and the reference is
dropped again by if_sdio_power_save() when the interface is brought
down.  If if_sdio_power_on() fails (SDIO function enable, CCCR
access, or firmware programming), the error is returned without
releasing the runtime PM reference, leaking it and keeping the
device runtime-resumed.

Drop the reference on the power-on failure path.

Fixes: 7e1f79a1f5fe ("libertas: implement if_sdio runtime power management")
Cc: stable at vger.kernel.org
Signed-off-by: Zhao Feng <zhaofeng2 at cmss.chinamobile.com>
---
Verified against current upstream master.  Not runtime-tested (no
libertas SDIO hardware).

 drivers/net/wireless/marvell/libertas/if_sdio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/libertas/if_sdio.c b/drivers/net/wireless/marvell/libertas/if_sdio.c
--- a/drivers/net/wireless/marvell/libertas/if_sdio.c
+++ b/drivers/net/wireless/marvell/libertas/if_sdio.c
@@ -1086,6 +1086,8 @@ static int if_sdio_power_restore(struct lbs_private *priv)
 
 	r = if_sdio_power_on(card);
-	if (r)
+	if (r) {
+		pm_runtime_put_sync(&card->func->dev);
 		return r;
+	}
 
 	wait_event(card->pwron_waitq, priv->fw_ready);
-- 
2.39.2






More information about the libertas-dev mailing list