lkml.org 
[lkml]   [2010]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [Patch] ext4: avoid null dereference
From
Date
On Fri, 2010-08-27 at 16:49 +0800, Wen Congyang wrote:
> ac->inode is set to null in function ext4_mb_release_group_pa(),
> and then trace_ext4_mballoc_discard(ac) is called, the kernel
> will panic.

> diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
> index 01e9e00..6a1fcff 100644
> --- a/include/trace/events/ext4.h
> +++ b/include/trace/events/ext4.h
> @@ -796,8 +796,9 @@ DECLARE_EVENT_CLASS(ext4__mballoc,
> ),
>
> TP_fast_assign(
> - __entry->dev = ac->ac_inode->i_sb->s_dev;
> - __entry->ino = ac->ac_inode->i_ino;
> + __entry->dev = ac->ac_sb->s_dev;
> + __entry->ino = ac->ac_inode ?
> + ac->ac_inode->i_ino : 0;

Is i_ino == 0 a valid inode number?

If not, then

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> __entry->result_logical = ac->ac_b_ex.fe_logical;
> __entry->result_start = ac->ac_b_ex.fe_start;
> __entry->result_group = ac->ac_b_ex.fe_group;




\
 
 \ /
  Last update: 2010-08-31 19:45    [W:0.061 / U:1.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site