Re: [PATCH v2] rpmsg: char: Drop messages that arrive while the device is closed

From: Chrispine Tinega

Date: Thu Dec 03 2026 - 23:08:51 EST


Hi Mathieu,

On Thu, Dec 03, 2026 at 11:24:48AM -0600, Mathieu Poirier wrote:
> > + if (eptdev->default_ept && !eptdev->ept) {
>
> Is there a point in checking @eptdev->default at all? From what I understand,
> checking @eptdev->ept should be sufficient.
>
> Otherwise I'm good with your patch.

For a non-default endpoint, rpmsg_eptdev_open() calls rpmsg_create_ept()
and only assigns eptdev->ept after it returns. A transport can invoke
rpmsg_ept_cb() inside that window while eptdev->ept is still NULL.

For example, qcom_smd_create_ept() -> qcom_smd_channel_open() installs
the callback and moves the channel to SMD_CHANNEL_OPENED before sleeping
for the remote state. If the remote side opens and sends an initial
message, qcom_smd_channel_intr() runs rpmsg_ept_cb() in IRQ context
before rpmsg_eptdev_open() wakes up to set eptdev->ept.
virtio_rpmsg_create_ept() also registers the endpoint in vrp->endpoints
before returning.

Checking !eptdev->ept unconditionally would drop those initial messages
on a newly opened non-default endpoint. On release, non-default
endpoints are already torn down by rpmsg_destroy_ept(), so only
eptdev->default_ept needs this guard.

Let me know if you want a brief comment noting that in rpmsg_ept_cb() in
a v3, or if v2 is fine as is.

Regards,
Chrispine