|
@@ -1257,11 +1257,13 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
|
|
|
&sparse->header, sizeof(*sparse) +
|
|
|
(sparse->nr_areas *
|
|
|
sizeof(*sparse->areas)));
|
|
|
- kfree(sparse);
|
|
|
- if (ret)
|
|
|
+ if (ret) {
|
|
|
+ kfree(sparse);
|
|
|
return ret;
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
+ kfree(sparse);
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
}
|
|
@@ -1277,6 +1279,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
|
|
|
sizeof(info), caps.buf,
|
|
|
caps.size)) {
|
|
|
kfree(caps.buf);
|
|
|
+ kfree(sparse);
|
|
|
return -EFAULT;
|
|
|
}
|
|
|
info.cap_offset = sizeof(info);
|
|
@@ -1285,6 +1288,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
|
|
|
kfree(caps.buf);
|
|
|
}
|
|
|
|
|
|
+ kfree(sparse);
|
|
|
return copy_to_user((void __user *)arg, &info, minsz) ?
|
|
|
-EFAULT : 0;
|
|
|
} else if (cmd == VFIO_DEVICE_GET_IRQ_INFO) {
|