Skip to content

Commit f199100

Browse files
raven-aubrauner
authored andcommitted
autofs: fix thinko in validate_dev_ioctl()
I was so sure the per-dentry expire timeout patch worked ok but my testing was flawed. In validate_dev_ioctl() the check for ioctl AUTOFS_DEV_IOCTL_TIMEOUT_CMD should use the ioctl number not the passed in ioctl command. Fixes: 433f9d7 ("autofs: add per dentry expire timeout") Cc: <[email protected]> # mainline only Signed-off-by: Ian Kent <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent e65a0dc commit f199100

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fs/autofs/dev-ioctl.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ static inline void free_dev_ioctl(struct autofs_dev_ioctl *param)
110110
*/
111111
static int validate_dev_ioctl(int cmd, struct autofs_dev_ioctl *param)
112112
{
113+
unsigned int inr = _IOC_NR(cmd);
113114
int err;
114115

115116
err = check_dev_ioctl_version(cmd, param);
@@ -133,16 +134,14 @@ static int validate_dev_ioctl(int cmd, struct autofs_dev_ioctl *param)
133134
* check_name() return for AUTOFS_DEV_IOCTL_TIMEOUT_CMD.
134135
*/
135136
err = check_name(param->path);
136-
if (cmd == AUTOFS_DEV_IOCTL_TIMEOUT_CMD)
137+
if (inr == AUTOFS_DEV_IOCTL_TIMEOUT_CMD)
137138
err = err ? 0 : -EINVAL;
138139
if (err) {
139140
pr_warn("invalid path supplied for cmd(0x%08x)\n",
140141
cmd);
141142
goto out;
142143
}
143144
} else {
144-
unsigned int inr = _IOC_NR(cmd);
145-
146145
if (inr == AUTOFS_DEV_IOCTL_OPENMOUNT_CMD ||
147146
inr == AUTOFS_DEV_IOCTL_REQUESTER_CMD ||
148147
inr == AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD) {

0 commit comments

Comments
 (0)