This is an automated email from the ASF dual-hosted git repository.

michallenc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit a6f6731fef40013291078a88a8a054fdb312378a
Author: Bowen Wang <[email protected]>
AuthorDate: Fri Oct 30 01:14:15 2026 +0800

    drivers/rptun: do not send a command before the rsc table is set
    
    rptun_initialize() registers the panic notifier and adds the instance
    to the global list even when the remote is not auto-started, but
    priv->rproc.rsc_table is only set later in rptun_do_start(). A panic
    or an RPTUNIOC_RESET in that window reaches rptun_send_command(), which
    dereferences RPTUN_RSC2CMD(NULL).
    
    Return early from rptun_send_command() while the rsc table is not set.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/rptun/rptun.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c
index 8e73324d485..cfcf22602d5 100644
--- a/drivers/rptun/rptun.c
+++ b/drivers/rptun/rptun.c
@@ -694,8 +694,14 @@ static int rptun_create_devices(FAR struct rptun_priv_s 
*priv)
 static void rptun_send_command(FAR struct rptun_priv_s *priv,
                                uint32_t cmd, bool wait)
 {
-  FAR struct rptun_cmd_s *rptun_cmd = RPTUN_RSC2CMD(priv->rproc.rsc_table);
+  FAR struct rptun_cmd_s *rptun_cmd;
+
+  if (priv->rproc.rsc_table == NULL)
+    {
+      return;
+    }
 
+  rptun_cmd = RPTUN_RSC2CMD(priv->rproc.rsc_table);
   if (RPTUN_IS_MASTER(priv->dev))
     {
       rptun_cmd->cmd_master = cmd;

Reply via email to