This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit bc96d1bb36d741320c7d6b83bea459d5d3d7110c Author: Yongrong Wang <[email protected]> AuthorDate: Wed Nov 4 13:16:17 2026 +0800 net/rpmsg: set endpoint priority before creating the endpoint rpmsg_set_priority() was called after rpmsg_create_ept() on the client side, so the endpoint was briefly live at the default priority and the setting could be missed by messages arriving in that window. Move the call ahead of endpoint creation. The accepted-connection endpoint is already set up in that order by "net/rpmsg: fix the issue of 'use after free' at rpmsgs_dec_ref", which had to move the whole setup ahead of rpmsg_create_ept(). Also reject RPMSG_PRIO_RT from SO_PRIORITY: that level is reserved for internal real-time traffic and must not be selectable by applications. Signed-off-by: Yongrong Wang <[email protected]> Signed-off-by: zhanghongyu <[email protected]> --- net/rpmsg/rpmsg_sockif.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/rpmsg/rpmsg_sockif.c b/net/rpmsg/rpmsg_sockif.c index 7ae2958a671..c415abe131d 100644 --- a/net/rpmsg/rpmsg_sockif.c +++ b/net/rpmsg/rpmsg_sockif.c @@ -681,10 +681,10 @@ static void rpmsg_socket_device_created(FAR struct rpmsg_device *rdev, conn->ept.release_cb = rpmsg_socket_ept_release; rpmsg_socket_format_name(conn, namebuf); + rpmsg_set_priority(&conn->ept, conn->priority); rpmsg_create_ept(&conn->ept, rdev, namebuf, RPMSG_ADDR_ANY, RPMSG_ADDR_ANY, rpmsg_socket_ept_cb, rpmsg_socket_ns_unbind); - rpmsg_set_priority(&conn->ept, conn->priority); } } @@ -1847,7 +1847,11 @@ static int rpmsg_socket_setsockopt(FAR struct socket *psock, int level, *(FAR const int *)value : (int)*(FAR const unsigned char *)value; - if (priority < RPMSG_PRIO_MIN || priority > RPMSG_PRIO_MAX) + /* RPMSG_PRIO_RT is reserved for internal real-time traffic + * and must not be requested by applications. + */ + + if (priority < RPMSG_PRIO_MIN || priority >= RPMSG_PRIO_RT) { return -EINVAL; }
