提交 0eac940b 编写于 作者: D David Woodhouse

[JFFS2] Add some preemptive BUG checks for XATTR code

In a couple of places, we assume that what's at the end of the
->next_in_ino list is a struct jffs2_inode_cache. Let's check
for that, since we expect it to change soon.
Signed-off-by: NDavid Woodhouse <dwmw2@infradead.org>
上级 fcb75787
...@@ -230,6 +230,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c, ...@@ -230,6 +230,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
at the end of the linked list. Stash it and continue at the end of the linked list. Stash it and continue
from the beginning of the list */ from the beginning of the list */
ic = (struct jffs2_inode_cache *)(*prev); ic = (struct jffs2_inode_cache *)(*prev);
BUG_ON(ic->class != RAWNODE_CLASS_INODE_CACHE);
prev = &ic->nodes; prev = &ic->nodes;
continue; continue;
} }
......
...@@ -661,6 +661,10 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref ...@@ -661,6 +661,10 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
spin_lock(&c->erase_completion_lock); spin_lock(&c->erase_completion_lock);
ic = jffs2_raw_ref_to_ic(ref); ic = jffs2_raw_ref_to_ic(ref);
/* It seems we should never call jffs2_mark_node_obsolete() for
XATTR nodes.... yet. Make sure we notice if/when we change
that :) */
BUG_ON(ic->class != RAWNODE_CLASS_INODE_CACHE);
for (p = &ic->nodes; (*p) != ref; p = &((*p)->next_in_ino)) for (p = &ic->nodes; (*p) != ref; p = &((*p)->next_in_ino))
; ;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册