Re: [PATCH v3] vhost: fix use-after-free in fdset during shutdown

Stephen Hemminger
2026-02-04T20:34:32Z

On Wed, 4 Feb 2026 19:58:00 +0100
Yehor Malikov <malikovyehor@gmail.com> wrote:

> + /* Remove from global fdsets list */
> + pthread_mutex_lock(&fdsets_mutex);
> + for (i = 0; i < MAX_FDSETS; i++) {
> + if (fdsets[i] == pfdset) {
> + fdsets[i] = NULL;
> + break;
> + }
> + }
> + pthread_mutex_unlock(&fdsets_mutex);
> +
> + /* Free the fdset */
> + rte_free(pfdset);
> +}
> +

Calling mutex_lock in destructor seems it could be a problem.
Also, I would put in a destructor unless the init was called
by a constructor.