Skip to content

Commit

Permalink
fs/virtio-9p:When virtio-9p is not supported, return -ENODEV
Browse files Browse the repository at this point in the history
Summary:
  When the operating environment does not support virtio-9p and the virtio-9p server driver is not provided, -ENODEV should be returned for virtio-9p to avoid crash caused by continued execution.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
  • Loading branch information
crafcat7 committed Feb 26, 2025
1 parent 2a9b916 commit e9434fd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/v9fs/virtio_9p.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ static int virtio_9p_create(FAR struct v9fs_transport_s **transport,
priv->transport.ops = &g_virtio_9p_transport_ops;
*transport = &priv->transport;
ret = virtio_register_driver(&priv->vdrv);
if (priv->vdev == NULL)
{
/* No corresponding driver was found, we should return an error */

ret = -ENODEV;
}

if (ret < 0)
{
fs_heap_free(priv);
Expand Down

0 comments on commit e9434fd

Please sign in to comment.