diff options
| -rw-r--r-- | fs/autofs4/autofs_i.h | 11 | ||||
| -rw-r--r-- | fs/autofs4/dev-ioctl.c | 2 | ||||
| -rw-r--r-- | fs/autofs4/inode.c | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index d8d8e7ba6a1e..908e18455413 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
| @@ -269,6 +269,17 @@ int autofs4_fill_super(struct super_block *, void *, int); | |||
| 269 | struct autofs_info *autofs4_new_ino(struct autofs_sb_info *); | 269 | struct autofs_info *autofs4_new_ino(struct autofs_sb_info *); |
| 270 | void autofs4_clean_ino(struct autofs_info *); | 270 | void autofs4_clean_ino(struct autofs_info *); |
| 271 | 271 | ||
| 272 | static inline int autofs_prepare_pipe(struct file *pipe) | ||
| 273 | { | ||
| 274 | if (!pipe->f_op || !pipe->f_op->write) | ||
| 275 | return -EINVAL; | ||
| 276 | if (!S_ISFIFO(pipe->f_dentry->d_inode->i_mode)) | ||
| 277 | return -EINVAL; | ||
| 278 | /* We want a packet pipe */ | ||
| 279 | pipe->f_flags |= O_DIRECT; | ||
| 280 | return 0; | ||
| 281 | } | ||
| 282 | |||
| 272 | /* Queue management functions */ | 283 | /* Queue management functions */ |
| 273 | 284 | ||
| 274 | int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify); | 285 | int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify); |
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c index 3dfd615afb6b..aa9103f8f01b 100644 --- a/fs/autofs4/dev-ioctl.c +++ b/fs/autofs4/dev-ioctl.c | |||
| @@ -376,7 +376,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp, | |||
| 376 | err = -EBADF; | 376 | err = -EBADF; |
| 377 | goto out; | 377 | goto out; |
| 378 | } | 378 | } |
| 379 | if (!pipe->f_op || !pipe->f_op->write) { | 379 | if (autofs_prepare_pipe(pipe) < 0) { |
| 380 | err = -EPIPE; | 380 | err = -EPIPE; |
| 381 | fput(pipe); | 381 | fput(pipe); |
| 382 | goto out; | 382 | goto out; |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 14c7bc02349e..6e488ebe7784 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
| @@ -290,7 +290,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
| 290 | printk("autofs: could not open pipe file descriptor\n"); | 290 | printk("autofs: could not open pipe file descriptor\n"); |
| 291 | goto fail_dput; | 291 | goto fail_dput; |
| 292 | } | 292 | } |
| 293 | if (!pipe->f_op || !pipe->f_op->write) | 293 | if (autofs_prepare_pipe(pipe) < 0) |
| 294 | goto fail_fput; | 294 | goto fail_fput; |
| 295 | sbi->pipe = pipe; | 295 | sbi->pipe = pipe; |
| 296 | sbi->pipefd = pipefd; | 296 | sbi->pipefd = pipefd; |
