Skip to content

Commit a118bc3

Browse files
Iouri Tarassovchessturo
authored andcommitted
drivers: hv: dxgkrnl: Fixed the implementation of D3DKMTQueryClockCalibration
The result of a VM bus call was not copied to the user output structure. Signed-off-by: Iouri Tarassov <iourit@linux.microsoft.com> [kms: forward port to 6.6 from 6.1. No code changes made.] Signed-off-by: Kelsey Steele <kelseysteele@microsoft.com>
1 parent e6ba173 commit a118bc3

2 files changed

Lines changed: 10 additions & 13 deletions

File tree

drivers/hv/dxgkrnl/dxgvmbus.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,35 +1966,37 @@ int dxgvmb_send_query_clock_calibration(struct dxgprocess *process,
19661966
*__user inargs)
19671967
{
19681968
struct dxgkvmb_command_queryclockcalibration *command;
1969-
struct dxgkvmb_command_queryclockcalibration_return result;
1969+
struct dxgkvmb_command_queryclockcalibration_return *result;
19701970
int ret;
1971-
struct dxgvmbusmsg msg = {.hdr = NULL};
1971+
struct dxgvmbusmsgres msg = {.hdr = NULL};
19721972

1973-
ret = init_message(&msg, adapter, process, sizeof(*command));
1973+
ret = init_message_res(&msg, adapter, sizeof(*command),
1974+
sizeof(*result));
19741975
if (ret)
19751976
goto cleanup;
19761977
command = (void *)msg.msg;
1978+
result = msg.res;
19771979

19781980
command_vgpu_to_host_init2(&command->hdr,
19791981
DXGK_VMBCOMMAND_QUERYCLOCKCALIBRATION,
19801982
process->host_handle);
19811983
command->args = *args;
19821984

19831985
ret = dxgvmb_send_sync_msg(msg.channel, msg.hdr, msg.size,
1984-
&result, sizeof(result));
1986+
result, sizeof(*result));
19851987
if (ret < 0)
19861988
goto cleanup;
1987-
ret = copy_to_user(&inargs->clock_data, &result.clock_data,
1988-
sizeof(result.clock_data));
1989+
ret = copy_to_user(&inargs->clock_data, &result->clock_data,
1990+
sizeof(result->clock_data));
19891991
if (ret) {
19901992
DXG_ERR("failed to copy clock data");
19911993
ret = -EFAULT;
19921994
goto cleanup;
19931995
}
1994-
ret = ntstatus2int(result.status);
1996+
ret = ntstatus2int(result->status);
19951997

19961998
cleanup:
1997-
free_message(&msg);
1999+
free_message((struct dxgvmbusmsg *)&msg);
19982000
if (ret)
19992001
DXG_TRACE("err: %d", ret);
20002002
return ret;

drivers/hv/dxgkrnl/ioctl.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4303,11 +4303,6 @@ dxgkio_query_clock_calibration(struct dxgprocess *process, void *__user inargs)
43034303
&args, inargs);
43044304
if (ret < 0)
43054305
goto cleanup;
4306-
ret = copy_to_user(inargs, &args, sizeof(args));
4307-
if (ret) {
4308-
DXG_ERR("failed to copy output args");
4309-
ret = -EFAULT;
4310-
}
43114306

43124307
cleanup:
43134308

0 commit comments

Comments
 (0)