diff options
author | Oleg Nesterov <oleg@redhat.com> | 2013-01-28 11:08:47 -0500 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2013-02-08 12:24:14 -0500 |
commit | 7e4e28c53963e6cfa94d8109bb8f5233c5659048 (patch) | |
tree | 5405bc0552ef0f2d8c67bb9ef6b391f5a7a504b3 /kernel/trace/trace_uprobe.c | |
parent | 4161824f18ff4f56f46595a4016c7315dd0d24f1 (diff) |
uprobes/tracing: Ensure inode != NULL in create_trace_uprobe()
probe_event_enable/disable() check tu->inode != NULL at the start.
This is ugly, if igrab() can fail create_trace_uprobe() should not
succeed and "postpone" the failure.
And S_ISREG(inode->i_mode) check added by d24d7dbf is not safe.
Note: alloc_uprobe() should probably check igrab() != NULL as well.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/trace/trace_uprobe.c')
-rw-r--r-- | kernel/trace/trace_uprobe.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 15b8eceeddc5..f7838cfd61b9 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c | |||
@@ -256,7 +256,7 @@ static int create_trace_uprobe(int argc, char **argv) | |||
256 | inode = igrab(path.dentry->d_inode); | 256 | inode = igrab(path.dentry->d_inode); |
257 | path_put(&path); | 257 | path_put(&path); |
258 | 258 | ||
259 | if (!S_ISREG(inode->i_mode)) { | 259 | if (!inode || !S_ISREG(inode->i_mode)) { |
260 | ret = -EINVAL; | 260 | ret = -EINVAL; |
261 | goto fail_address_parse; | 261 | goto fail_address_parse; |
262 | } | 262 | } |
@@ -544,7 +544,7 @@ static int probe_event_enable(struct trace_uprobe *tu, int flag) | |||
544 | struct uprobe_trace_consumer *utc; | 544 | struct uprobe_trace_consumer *utc; |
545 | int ret = 0; | 545 | int ret = 0; |
546 | 546 | ||
547 | if (!tu->inode || tu->consumer) | 547 | if (tu->consumer) |
548 | return -EINTR; | 548 | return -EINTR; |
549 | 549 | ||
550 | utc = kzalloc(sizeof(struct uprobe_trace_consumer), GFP_KERNEL); | 550 | utc = kzalloc(sizeof(struct uprobe_trace_consumer), GFP_KERNEL); |
@@ -568,7 +568,7 @@ static int probe_event_enable(struct trace_uprobe *tu, int flag) | |||
568 | 568 | ||
569 | static void probe_event_disable(struct trace_uprobe *tu, int flag) | 569 | static void probe_event_disable(struct trace_uprobe *tu, int flag) |
570 | { | 570 | { |
571 | if (!tu->inode || !tu->consumer) | 571 | if (!tu->consumer) |
572 | return; | 572 | return; |
573 | 573 | ||
574 | uprobe_unregister(tu->inode, tu->offset, &tu->consumer->cons); | 574 | uprobe_unregister(tu->inode, tu->offset, &tu->consumer->cons); |