[PATCH 3/3] vhost: fix mmap error check in VDUSE IOTLB miss handler

David Marchand david.marchand at redhat.com
Thu Jan 8 15:49:25 CET 2026


On Thu, 8 Jan 2026 at 14:50, Maxime Coquelin <maxime.coquelin at redhat.com> wrote:
>
> The mmap() function returns MAP_FAILED on failure, not NULL.
> The current check for !mmap_addr will never detect mmap failures.
>
> When mmap fails but the error is not detected, an invalid address (-1)
> is inserted into the IOTLB cache via vhost_user_iotlb_cache_insert().
> Subsequent attempts to access this address will cause memory
> corruption or crash.
>
> Fix by checking for MAP_FAILED instead of NULL. Also add strerror to
> the error message for easier debugging.
>
> Fixes: f27d5206c598 ("vhost: add VDUSE callback for IOTLB miss")
> Cc: stable at dpdk.org
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>

Ugh.. I should have caught it when reviewing initial commit..
Reviewed-by: David Marchand <david.marchand at redhat.com>


-- 
David Marchand



More information about the stable mailing list