diff options
author | Ian Kent <raven@themaw.net> | 2018-08-20 14:16:01 +0800 |
---|---|---|
committer | Ian Kent <ikent@redhat.com> | 2018-08-20 14:16:01 +0800 |
commit | b7a6cee59259fe4cebf116bf61dab45e4e0ce473 (patch) | |
tree | 8a8680a369cff7a2e582ed39958f1960961a6489 | |
parent | 2ad0d52699700a91660a406a4046017a2d7f246a (diff) | |
download | syzbot-bug-syzbot.tar.gz |
autofs - fix autofs_sbi()syzbot
The autofs_sbi() inline function does not check the super block
magic number to verify it has been given an autofs super block.
Reported-by: syzbot+87c3c541582e56943277@syzkaller.appspotmail.com
Signed-off-by: Ian Kent <raven@themaw.net>
-rw-r--r-- | fs/autofs/autofs_i.h | 4 | ||||
-rw-r--r-- | fs/autofs/inode.c | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h index 9400a9f6318a0f..5057b9f0f84610 100644 --- a/fs/autofs/autofs_i.h +++ b/fs/autofs/autofs_i.h @@ -26,6 +26,7 @@ #include <linux/list.h> #include <linux/completion.h> #include <linux/file.h> +#include <linux/magic.h> /* This is the range of ioctl() numbers we claim as ours */ #define AUTOFS_IOC_FIRST AUTOFS_IOC_READY @@ -124,7 +125,8 @@ struct autofs_sb_info { static inline struct autofs_sb_info *autofs_sbi(struct super_block *sb) { - return (struct autofs_sb_info *)(sb->s_fs_info); + return sb->s_magic != AUTOFS_SUPER_MAGIC ? + NULL : (struct autofs_sb_info *)(sb->s_fs_info); } static inline struct autofs_info *autofs_dentry_ino(struct dentry *dentry) diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index b51980fc274e6c..846c052569dd49 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c @@ -10,7 +10,6 @@ #include <linux/seq_file.h> #include <linux/pagemap.h> #include <linux/parser.h> -#include <linux/magic.h> #include "autofs_i.h" |