Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpmsg_virtio: rpmsg_deinit_vdev: Add check for empty endpoint list #605

Conversation

bentheredonethat
Copy link
Contributor

There can exist scenario where the endpoint list in a rpmsg vdev can be empty of endpoint-created nodes but the original remains, check if that is the case to ensure the while loop can properly terminate.

There can exist scenario where the endpoint list in a rpmsg vdev can be
empty of endpoint-created nodes but the original remains, check if that
is the case to ensure the while loop can properly terminate.

Signed-off-by: Ben Levinsky <[email protected]>
@bentheredonethat
Copy link
Contributor Author

CC @tnmysh

@wmamills
Copy link
Collaborator

wmamills commented Aug 7, 2024

@bentheredonethat can you describe the scenario that where this arises?

@bentheredonethat
Copy link
Contributor Author

I see this as bug in rpmsg_deinit_vdev because the initial list head is created before rpsmg-create endpoint and this adds check for that initial list head node.

@bentheredonethat
Copy link
Contributor Author

I took a further look. Because there can exist independtly the RPMsg vdev's ns_ept I believe that the alternative solution of moving the RPMsg vdev's list of endpoints to create endpoint is not valid.

Given that, I think keeping the logic as is (the existing patch) is valid.

CC @wmamills

Copy link
Collaborator

@tnmysh tnmysh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@arnopo
Copy link
Collaborator

arnopo commented Aug 26, 2024

The point is not clear to me I cannot figure out how we can have "node->next == NULL" regarding metal_list_XXX macro
after metal_list_init(&rdev->endpoints)

    rdev->endpoints.prev = rdev->endpoints;
    rdev->endpoints.next = rdev->endpoints;

After rpmsg_register_endpoint(rdev, &rdev->ns_ept,, ...)

    rdev->endpoints.prev =  rdev->ns_ept->node;
    rdev->endpoints.next =  rdev->ns_ept->node;

    rdev->ns_ept->node.prev =  rdev->endpoints;
    rdev->ns_ept->node.next =  rdev->endpoints;

After metal_list_del(&ept->node)

    rdev->endpoints.prev =   rdev->endpoints;
    rdev->endpoints.next =   rdev->endpoints;

   rdev->ns_ept->node =  rdev->ns_ept->node;
   rdev->ns_ept->node =  rdev->ns_ept->node;

Please could you detail the sequence?

@bentheredonethat
Copy link
Contributor Author

we can skip this after further inspection. will close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants