autofs: fix dev ioctl number range check
authorIan Kent <raven@themaw.net>
Sat, 10 Sep 2016 10:34:25 +0000 (20:34 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Sat, 10 Sep 2016 10:34:25 +0000 (20:34 +1000)
The count of miscellaneous device ioctls in fs/autofs4/autofs_i.h is wrong.

The number of ioctls is the difference between AUTOFS_DEV_IOCTL_VERSION_CMD
and AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD (14) not the difference between
AUTOFS_IOC_COUNT and 11 (21).

Link: http://lkml.kernel.org/r/20160812024841.12352.11975.stgit@pluto.themaw.net
Signed-off-by: Ian Kent <raven@themaw.net>
Cc: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/autofs4/autofs_i.h
fs/autofs4/dev-ioctl.c

index 73e3d3810e3fa3e58b46be521420b9b0fb08ab05..dd71bd4ff903bed270098daff620e4c47854d70d 100644 (file)
@@ -20,7 +20,8 @@
 #define AUTOFS_IOC_COUNT     32
 
 #define AUTOFS_DEV_IOCTL_IOC_FIRST     (AUTOFS_DEV_IOCTL_VERSION)
-#define AUTOFS_DEV_IOCTL_IOC_COUNT     (AUTOFS_IOC_COUNT - 11)
+#define AUTOFS_DEV_IOCTL_IOC_COUNT \
+       (AUTOFS_DEV_IOCTL_VERSION_CMD - AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD)
 
 #include <linux/kernel.h>
 #include <linux/slab.h>
index d47b35a669e10daf261125a706c77dd28323ee74..13e75177f8927199af4444f09d98f6d9555ce087 100644 (file)
@@ -642,7 +642,7 @@ static int _autofs_dev_ioctl(unsigned int command,
        cmd = _IOC_NR(command);
 
        if (_IOC_TYPE(command) != _IOC_TYPE(AUTOFS_DEV_IOCTL_IOC_FIRST) ||
-           cmd - cmd_first >= AUTOFS_DEV_IOCTL_IOC_COUNT) {
+           cmd - cmd_first > AUTOFS_DEV_IOCTL_IOC_COUNT) {
                return -ENOTTY;
        }
 
This page took 0.027753 seconds and 5 git commands to generate.