Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915/gvt: fix a memory leak in intel_gvt_init_vgpu_types

gvt->types needs to be freed on error.

Fixes: bc90d097ae14 ("drm/i915/gvt: define weight according to vGPU type")
Reported-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Link: https://lore.kernel.org/r/20220923092652.100656-2-hch@lst.de
[aw: Correct fixes commit ID as reported by Stephen Rothwell]
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

authored by

Christoph Hellwig and committed by
Alex Williamson
98828955 f423fa1b

+5 -1
+5 -1
drivers/gpu/drm/i915/gvt/vgpu.c
··· 142 142 143 143 if (vgpu_types[i].weight < 1 || 144 144 vgpu_types[i].weight > VGPU_MAX_WEIGHT) 145 - return -EINVAL; 145 + goto out_free_types; 146 146 147 147 gvt->types[i].weight = vgpu_types[i].weight; 148 148 gvt->types[i].resolution = vgpu_types[i].edid; ··· 167 167 168 168 gvt->num_types = i; 169 169 return 0; 170 + 171 + out_free_types: 172 + kfree(gvt->types); 173 + return -EINVAL; 170 174 } 171 175 172 176 void intel_gvt_clean_vgpu_types(struct intel_gvt *gvt)