diff options
| author | Stanislav Kinsburskii <skinsburskii@linux.microsoft.com> | 2026-05-07 18:44:37 +0300 |
|---|---|---|
| committer | Wei Liu <wei.liu@kernel.org> | 2026-07-31 23:01:57 +0300 |
| commit | f546be6a19d24d02be576d8617cb26c7acb61594 (patch) | |
| tree | 56b79991f2f25da4f8dcc625e7d7e77e21edb086 /drivers | |
| parent | 0289a67cd70bf9d3807e289f4efd643e16a6c6b4 (diff) | |
| download | linux-f546be6a19d24d02be576d8617cb26c7acb61594.tar.xz | |
mshv: Fix missing error code on VP allocation failure
In mshv_partition_ioctl_create_vp(), when kzalloc for the VP struct
fails, the code jumps to the cleanup path without setting ret. At that
point ret is 0 from the preceding successful mshv_vp_stats_map() call,
so the function returns success to userspace despite having failed to
create the VP. No fd is installed and no VP is registered in pt_vp_array,
but userspace has no way to know the operation failed.
Set ret to -ENOMEM before jumping to the cleanup path.
Fixes: 621191d709b14 ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/hv/mshv_root_main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c index 146726cc4e9b..644f9b10cbba 100644 --- a/drivers/hv/mshv_root_main.c +++ b/drivers/hv/mshv_root_main.c @@ -1117,8 +1117,10 @@ mshv_partition_ioctl_create_vp(struct mshv_partition *partition, goto unmap_ghcb_page; vp = kzalloc_obj(*vp); - if (!vp) + if (!vp) { + ret = -ENOMEM; goto unmap_stats_pages; + } vp->vp_partition = mshv_partition_get(partition); if (!vp->vp_partition) { |
