All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] autofs: Add WARN_ON(1) for non dir/link inode case
@ 2016-07-04  3:40 Tomohiro Kusumi
  2016-07-07  6:09 ` Ian Kent
  0 siblings, 1 reply; 3+ messages in thread
From: Tomohiro Kusumi @ 2016-07-04  3:40 UTC (permalink / raw)
  To: raven, jeffm; +Cc: autofs, Tomohiro Kusumi

It's invalid if the given mode is neither dir nor link,
so warn on else case.

(v2 changed BUG_ON to WARN_ON)

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
---
 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..89174ec 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);
 
+	WARN_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
+		WARN_ON(1);
 
 	return inode;
 }
-- 
2.5.5

--
To unsubscribe from this list: send the line "unsubscribe autofs" in

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-07  6:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-04  3:40 [PATCH v2] autofs: Add WARN_ON(1) for non dir/link inode case Tomohiro Kusumi
2016-07-07  6:09 ` Ian Kent
2016-07-07  6:46   ` Tomohiro Kusumi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.