summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorCharles Baylis <cb-kernel@fishzet.co.uk>2021-07-16 17:43:12 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-28 11:12:20 +0200
commit97da260e9ef6f5359f19d81d0a1086db04091b7e (patch)
treed3bd76017b831735ae7e21a63e5ca23faf6475b1 /include
parent61b89b41bd43c76b3856113d6109139c6dbe0b7b (diff)
downloadlinux-stable-97da260e9ef6f5359f19d81d0a1086db04091b7e.tar.gz
linux-stable-97da260e9ef6f5359f19d81d0a1086db04091b7e.tar.bz2
linux-stable-97da260e9ef6f5359f19d81d0a1086db04091b7e.zip
drm: Return -ENOTTY for non-drm ioctls
commit 3abab27c322e0f2acf981595aa8040c9164dc9fb upstream. drm: Return -ENOTTY for non-drm ioctls Return -ENOTTY from drm_ioctl() when userspace passes in a cmd number which doesn't relate to the drm subsystem. Glibc uses the TCGETS ioctl to implement isatty(), and without this change isatty() returns it incorrectly returns true for drm devices. To test run this command: $ if [ -t 0 ]; then echo is a tty; fi < /dev/dri/card0 which shows "is a tty" without this patch. This may also modify memory which the userspace application is not expecting. Signed-off-by: Charles Baylis <cb-kernel@fishzet.co.uk> Cc: stable@vger.kernel.org Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/YPG3IBlzaMhfPqCr@stando.fishzet.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm_ioctl.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/drm/drm_ioctl.h b/include/drm/drm_ioctl.h
index add42809642a..d9df199333fd 100644
--- a/include/drm/drm_ioctl.h
+++ b/include/drm/drm_ioctl.h
@@ -68,6 +68,7 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
unsigned long arg);
#define DRM_IOCTL_NR(n) _IOC_NR(n)
+#define DRM_IOCTL_TYPE(n) _IOC_TYPE(n)
#define DRM_MAJOR 226
/**