mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 12:35:52 +02:00
drm/nouveau: check ioctl command codes better
nouveau_drm_ioctl() only checks the _IOC_NR() bits in the
DRM_NOUVEAU_NVIF command, but ignores the type and direction bits, so any
command with '7' in the low eight bits gets passed into
nouveau_abi16_ioctl() instead of drm_ioctl().
Check for all the bits except the size that is handled inside of the
handler.
Fixes: 27111a23d0 ("drm/nouveau: expose the full object/event interfaces to userspace")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[ Fix up two checkpatch warnings and a typo. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/r/20250711072458.2665325-1-arnd@kernel.org
This commit is contained in:
parent
bd46cece51
commit
e5478166df
|
|
@ -1284,6 +1284,9 @@ nouveau_ioctls[] = {
|
||||||
DRM_IOCTL_DEF_DRV(NOUVEAU_EXEC, nouveau_exec_ioctl_exec, DRM_RENDER_ALLOW),
|
DRM_IOCTL_DEF_DRV(NOUVEAU_EXEC, nouveau_exec_ioctl_exec, DRM_RENDER_ALLOW),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DRM_IOCTL_NOUVEAU_NVIF _IOC(_IOC_READ | _IOC_WRITE, DRM_IOCTL_BASE, \
|
||||||
|
DRM_COMMAND_BASE + DRM_NOUVEAU_NVIF, 0)
|
||||||
|
|
||||||
long
|
long
|
||||||
nouveau_drm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
nouveau_drm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
|
|
@ -1297,14 +1300,10 @@ nouveau_drm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (_IOC_NR(cmd) - DRM_COMMAND_BASE) {
|
if ((cmd & ~IOCSIZE_MASK) == DRM_IOCTL_NOUVEAU_NVIF)
|
||||||
case DRM_NOUVEAU_NVIF:
|
|
||||||
ret = nouveau_abi16_ioctl(filp, (void __user *)arg, _IOC_SIZE(cmd));
|
ret = nouveau_abi16_ioctl(filp, (void __user *)arg, _IOC_SIZE(cmd));
|
||||||
break;
|
else
|
||||||
default:
|
|
||||||
ret = drm_ioctl(file, cmd, arg);
|
ret = drm_ioctl(file, cmd, arg);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pm_runtime_mark_last_busy(dev->dev);
|
pm_runtime_mark_last_busy(dev->dev);
|
||||||
pm_runtime_put_autosuspend(dev->dev);
|
pm_runtime_put_autosuspend(dev->dev);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user