Skip to content

Commit

Permalink
net: rpmsgdrv.c: prevent potential danger
Browse files Browse the repository at this point in the history
Provide support for NET_RPMSG_TRANSFER only:

"It is recommended to drop all messages with commands other than
NET_RPMSG_TRANSFER in function net_rpmsg_drv_ept_cb() of the
flight controller."

Signed-off-by: Eero Nurkkala <[email protected]>
  • Loading branch information
eenurkka committed Dec 4, 2023
1 parent 19b862a commit 83d684f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/net/rpmsgdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,13 @@ static int net_rpmsg_drv_ept_cb(FAR struct rpmsg_endpoint *ept, void *data,
FAR struct net_rpmsg_header_s *header = data;
uint32_t command = header->command;

#if defined (CONFIG_MPFS_IHC_CLIENT) || defined (CONFIG_MPFS_IHC_SBI)
if (command != NET_RPMSG_TRANSFER)
{
return -EINVAL;
}
#endif

if (command < sizeof(g_net_rpmsg_drv_handler) /
sizeof(g_net_rpmsg_drv_handler[0]))
{
Expand Down

0 comments on commit 83d684f

Please sign in to comment.