Commit 7db66084 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] Better UDF oops fix

Rather than not kfree'ing the UDF data in the case of a bad inode (which
still _may_ have had the UDF data already allocated to it), make sure to
initialize the pointer to NULL properly when we're done with it.
parent 0a6e048f
...@@ -126,8 +126,8 @@ void udf_delete_inode(struct inode * inode) ...@@ -126,8 +126,8 @@ void udf_delete_inode(struct inode * inode)
void udf_clear_inode(struct inode *inode) void udf_clear_inode(struct inode *inode)
{ {
if (!is_bad_inode(inode)) kfree(UDF_I_DATA(inode));
kfree(UDF_I_DATA(inode)); UDF_I_DATA(inode) = NULL;
} }
void udf_discard_prealloc(struct inode * inode) void udf_discard_prealloc(struct inode * inode)
......
...@@ -133,8 +133,10 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) ...@@ -133,8 +133,10 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
struct udf_inode_info *ei = (struct udf_inode_info *) foo; struct udf_inode_info *ei = (struct udf_inode_info *) foo;
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
SLAB_CTOR_CONSTRUCTOR) SLAB_CTOR_CONSTRUCTOR) {
ei->i_ext.i_data = NULL;
inode_init_once(&ei->vfs_inode); inode_init_once(&ei->vfs_inode);
}
} }
static int init_inodecache(void) static int init_inodecache(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment