| Submitter | Lukas Czerner |
|---|---|
| Date | May 20, 2011, 11:20 a.m. |
| Message ID | <1305890442-16361-4-git-send-email-lczerner@redhat.com> |
| Download | mbox | patch |
| Permalink | /patch/96587/ |
| State | Accepted |
| Headers | show |
Comments
On Fri, May 20, 2011 at 01:20:42AM -0000, Lukas Czerner wrote: > We need to take reference to the s_li_request after we take a mutex, > because it might be freed since then, hence result in accessing old > already freed memory. Also we should protect the whole > ext4_remove_li_request() because ext4_li_info might be in the process of > being freed in ext4_lazyinit_thread(). > > Signed-off-by: Lukas Czerner <lczerner@redhat.com> > Reviewed-by: Eric Sandeen <sandeen@redhat.com> I've merged all four lazyinit patches into the ext4 tree, thanks. - Ted -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Patch
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 72df905..f4d3333 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2720,14 +2720,16 @@ static void ext4_remove_li_request(struct ext4_li_request *elr) static void ext4_unregister_li_request(struct super_block *sb) { - struct ext4_li_request *elr = EXT4_SB(sb)->s_li_request; - - if (!ext4_li_info) + mutex_lock(&ext4_li_mtx); + if (!ext4_li_info) { + mutex_unlock(&ext4_li_mtx); return; + } mutex_lock(&ext4_li_info->li_list_mtx); - ext4_remove_li_request(elr); + ext4_remove_li_request(EXT4_SB(sb)->s_li_request); mutex_unlock(&ext4_li_info->li_list_mtx); + mutex_unlock(&ext4_li_mtx); } static struct task_struct *ext4_lazyinit_task;