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

Stephen Hemminger stephen at networkplumber.org
Wed Feb 4 21:34:24 CET 2026


On Wed,  4 Feb 2026 19:58:00 +0100
Yehor Malikov <malikovyehor at 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.


More information about the dev mailing list