* [PATCH wireless-next] wifi: libertas: clear priv->mesh_dev when registering it fails
@ 2026-11-28 23:26 Yuho Choi
0 siblings, 0 replies; only message in thread
From: Yuho Choi @ 2026-11-28 23:26 UTC (permalink / raw)
To: linux-wireless
Cc: Johannes Berg, David Woodhouse, Heiner Kallweit, libertas-dev,
Yuho Choi
lbs_add_mesh() stores the new mesh device in priv->mesh_dev before it
calls register_netdev(). If the registration fails, the device is freed
but priv->mesh_dev still points to it. Neither caller, lbs_start_mesh()
nor the lbs_mesh sysfs store, checks the return value, so the driver
keeps using the freed device: the RX, TX completion and multicast paths
dereference it, and lbs_remove_mesh() later unregisters it and frees it
and its wireless_dev a second time.
Clear priv->mesh_dev on the error path.
Fixes: 23a397ac821a ("libertas: add lbs_mesh sysfs attribute for enabling mesh")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
Compile-tested only (x86_64, LIBERTAS_USB=m, LIBERTAS_MESH=y; mesh.o is
clean with W=1). I don't have Libertas hardware, and register_netdev()
only fails here on an allocation failure or a notifier veto, so I could
not trigger this path.
drivers/net/wireless/marvell/libertas/mesh.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/wireless/marvell/libertas/mesh.c b/drivers/net/wireless/marvell/libertas/mesh.c
index 686b2e18a0e9..94e346947552 100644
--- a/drivers/net/wireless/marvell/libertas/mesh.c
+++ b/drivers/net/wireless/marvell/libertas/mesh.c
@@ -528,6 +528,7 @@ static int lbs_add_mesh(struct lbs_private *priv)
goto done;
err_free_netdev:
+ priv->mesh_dev = NULL;
free_netdev(mesh_dev);
err_free_wdev:
base-commit: 18d0bedbb5f0538396cb7f763ed9cd1dd69c5b23
--
2.56.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-28 23:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 23:26 [PATCH wireless-next] wifi: libertas: clear priv->mesh_dev when registering it fails Yuho Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox