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

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

commit 25e99b379a22ee0f1448164517a944ed1d869ace
Author: p-szafonimateusz <[email protected]>
AuthorDate: Wed Jun 3 11:30:17 2026 +0200

    drivers/vhost/vhost-i2c: clear the callback of the decoded message
    
    vhost_i2c_work() decodes each request into a struct i2c_msg_s on the
    stack, and virtio_i2c_decode() fills every field but callback and arg.
    A non-NULL callback asks the I2C master for an asynchronous transfer, so
    the stack garbage left there can turn a plain request into one that
    returns before the data is transferred, or calls a bogus function.
    Clear both.
    
    Signed-off-by: p-szafonimateusz <[email protected]>
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/vhost/vhost-i2c.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/vhost/vhost-i2c.c b/drivers/vhost/vhost-i2c.c
index 904b310006a..cd23f437df2 100644
--- a/drivers/vhost/vhost-i2c.c
+++ b/drivers/vhost/vhost-i2c.c
@@ -123,6 +123,8 @@ static int virtio_i2c_decode(FAR const struct 
virtio_i2c_out_hdr_s *out,
 
   msg->buffer = data;
   msg->length = buflen;
+  msg->callback = NULL;
+  msg->arg = NULL;
 
   return OK;
 }

Reply via email to