Skip to content

Commit

Permalink
uprobes/tracing: Fix dentry/mount leak in create_trace_uprobe()
Browse files Browse the repository at this point in the history
create_trace_uprobe() does kern_path() to find ->d_inode, but forgets
to do path_put(). We can do this right after igrab().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
  • Loading branch information
Oleg Nesterov committed Feb 8, 2013
1 parent e8440c1 commit 84d7ed7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions kernel/trace/trace_uprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,18 @@ static int create_trace_uprobe(int argc, char **argv)
if (ret)
goto fail_address_parse;

ret = kstrtoul(arg, 0, &offset);
if (ret)
goto fail_address_parse;

inode = igrab(path.dentry->d_inode);
path_put(&path);

if (!S_ISREG(inode->i_mode)) {
ret = -EINVAL;
goto fail_address_parse;
}

ret = kstrtoul(arg, 0, &offset);
if (ret)
goto fail_address_parse;

argc -= 2;
argv += 2;

Expand Down

0 comments on commit 84d7ed7

Please sign in to comment.