mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
drm/amdkfd: return -ENOTTY for unsupported IOCTLs
[ Upstream commit 57af162bfc ]
Some kfd ioctls may not be available depending on the kernel version the
user is running, as such we need to report -ENOTTY so userland can
determine the cause of the ioctl failure.
Signed-off-by: Geoffrey McRae <geoffrey.mcrae@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bc1ca06998
commit
0b240c76de
@@ -3253,8 +3253,10 @@ static long kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
|
|||||||
int retcode = -EINVAL;
|
int retcode = -EINVAL;
|
||||||
bool ptrace_attached = false;
|
bool ptrace_attached = false;
|
||||||
|
|
||||||
if (nr >= AMDKFD_CORE_IOCTL_COUNT)
|
if (nr >= AMDKFD_CORE_IOCTL_COUNT) {
|
||||||
|
retcode = -ENOTTY;
|
||||||
goto err_i1;
|
goto err_i1;
|
||||||
|
}
|
||||||
|
|
||||||
if ((nr >= AMDKFD_COMMAND_START) && (nr < AMDKFD_COMMAND_END)) {
|
if ((nr >= AMDKFD_COMMAND_START) && (nr < AMDKFD_COMMAND_END)) {
|
||||||
u32 amdkfd_size;
|
u32 amdkfd_size;
|
||||||
@@ -3267,8 +3269,10 @@ static long kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
|
|||||||
asize = amdkfd_size;
|
asize = amdkfd_size;
|
||||||
|
|
||||||
cmd = ioctl->cmd;
|
cmd = ioctl->cmd;
|
||||||
} else
|
} else {
|
||||||
|
retcode = -ENOTTY;
|
||||||
goto err_i1;
|
goto err_i1;
|
||||||
|
}
|
||||||
|
|
||||||
dev_dbg(kfd_device, "ioctl cmd 0x%x (#0x%x), arg 0x%lx\n", cmd, nr, arg);
|
dev_dbg(kfd_device, "ioctl cmd 0x%x (#0x%x), arg 0x%lx\n", cmd, nr, arg);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user