From: Sascha Hauer <s.hauer@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Subject: [PATCH 1/4] fs: devfs: remove aliases from the list when freeing them
Date: Mon, 31 Aug 2026 11:48:25 +0200 [thread overview]
Message-ID: <20260831-usbdisk-aliases-v1-1-0a2e40a35f3d@pengutronix.de> (raw)
In-Reply-To: <20260831-usbdisk-aliases-v1-0-0a2e40a35f3d@pengutronix.de>
devfs_remove_aliases() frees each struct cdev_alias without unlinking it
from cdev->aliases first, so on return the list head still points to
freed memory. Nothing trips over this today: the cdevs that get their
aliases removed are either freed right afterwards by cdev_free(), or the
list is re-initialized by devfs_create() when the cdev is registered
again. It is a trap waiting for the next caller though, so unlink the
entries properly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Assisted-by: Claude:claude-opus-5
---
fs/devfs-core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 522d883e1c..b9e34f83bb 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -583,6 +583,7 @@ static void devfs_remove_aliases(struct cdev *cdev)
list_for_each_entry_safe(alias, tmp, &cdev->aliases, list) {
devfs_unlink(alias->name);
+ list_del(&alias->list);
free(alias->name);
free(alias);
}
--
2.47.3
next prev parent reply other threads:[~2026-08-31 9:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 9:48 [PATCH 0/4] extend cdev alias support Sascha Hauer
2026-08-31 9:48 ` Sascha Hauer [this message]
2026-08-31 9:48 ` [PATCH 2/4] fs: remove the default automount when a cdev is removed Sascha Hauer
2026-08-31 9:48 ` [PATCH 3/4] fs: devfs: propagate cdev aliases to the partitions Sascha Hauer
2026-08-31 9:48 ` [PATCH 4/4] fs: devfs: make the default automount reachable under cdev aliases Sascha Hauer
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=20260831-usbdisk-aliases-v1-1-0a2e40a35f3d@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.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