From: Yuho Choi <oss.patchbox@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Johannes Berg <johannes@sipsolutions.net>,
David Woodhouse <dwmw2@infradead.org>,
Heiner Kallweit <hkall@kernel.org>,
libertas-dev@lists.infradead.org,
Yuho Choi <oss.patchbox@gmail.com>
Subject: [PATCH wireless-next] wifi: libertas: clear priv->mesh_dev when registering it fails
Date: Sat, 28 Nov 2026 23:26:06 +0000 [thread overview]
Message-ID: <20261128232607.849415-2-oss.patchbox@gmail.com> (raw)
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
reply other threads:[~2026-11-28 23:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261128232607.849415-2-oss.patchbox@gmail.com \
--to=oss.patchbox@gmail.com \
--cc=dwmw2@infradead.org \
--cc=hkall@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=libertas-dev@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox