Skip to contentSkip to conversation

most: configfs: ignore repeated create_link requests

PATCH New Avi Weiss 1 participant 1 message Oct 28 Most(r) technology driver

lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 most: configfs: ignore repeated create_link requests

mdev_link_create_link_store() adds a link to mdev_link_list even when create_link is already set. Two writes of 1 for a device that is not yet present insert the same list node twice, triggering a warning with CONFIG_DEBUG_LIST or corrupting the list without it.

Skip repeated requests until destroy_link has succeeded, allowing a later create_link request to create the link again.

Fixes acdbb8975373 ("staging: most: allow speculative configuration")
---
 drivers/most/configfs.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/most/configfs.c +2 -0
index 8f5158d95bc38..73794d2200125 100644
@@ -122,6 +122,8 @@ static ssize_t mdev_link_create_link_store(struct config_item *item,
 		return ret;
 	if (!tmp)
 		return count;
+	if (mdev_link->create_link && !mdev_link->destroy_link)
+		return count;
 	ret = set_config_and_add_link(mdev_link);
 	if (ret && ret != -ENODEV)
 		return ret;

base-commit: 65ba8f34ec886ec72b2c07ddc8cf3d815c32869d

Signature · 1 line
2.43.0