On 7/3/16 6:29 AM, Tomohiro Kusumi wrote: > It's invalid if the given mode is neither dir nor link, > so don't let it fallthrough on else case. Is this case really worth crashing the entire system? Wouldn't a WARN_ON + return -EINVAL be sufficient? At the very least it means that a developer doesn't need to reboot to reload the module if they hit this. -Jeff > Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@xxxxxxxxx> > --- > fs/autofs4/inode.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c > index ad0ee93..7f35c82 100644 > --- a/fs/autofs4/inode.c > +++ b/fs/autofs4/inode.c > @@ -305,6 +305,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) > if (autofs_type_trigger(sbi->type)) > __managed_dentry_set_managed(root); > > + BUG_ON(!root_inode->i_fop || !root_inode->i_op); > root_inode->i_fop = &autofs4_root_operations; > root_inode->i_op = &autofs4_dir_inode_operations; > > @@ -368,7 +369,8 @@ struct inode *autofs4_get_inode(struct super_block *sb, umode_t mode) > inode->i_fop = &autofs4_dir_operations; > } else if (S_ISLNK(mode)) { > inode->i_op = &autofs4_symlink_inode_operations; > - } > + } else > + BUG_ON(1); > > return inode; > } > -- Jeff Mahoney SUSE Labs
Attachment:
signature.asc
Description: OpenPGP digital signature