Otherwise, socket_net_file_get() will try to look up lwip's file
descriptors for file objects not created by lwip, reading garbage from
where it expects sock_fd in sock_net_file.
Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
file = ERR2PTR(-EINVAL);
goto EXIT;
}
+ if (fos->f_dentry->d_vnode->v_type != VSOCK) {
+ LWIP_DEBUGF(SOCKETS_DEBUG,
+ ("file descriptor is not a socket\n"));
+ file = ERR2PTR(-EBADF);
+ goto EXIT;
+ }
file = __containerof(fos, struct sock_net_file, vfscore_file);
EXIT:
return file;
uk_mutex_init(&s_vnode->v_lock);
s_vnode->v_refcnt = 1;
s_vnode->v_data = file;
+ s_vnode->v_type = VSOCK;
file->sock_fd = sock_fd;
LWIP_DEBUGF(SOCKETS_DEBUG, ("Allocated socket %d (%x)\n",