uprobes/tracing: Fix dentry/mount leak in create_trace_uprobe()
authorOleg Nesterov <oleg@redhat.com>
Sun, 27 Jan 2013 17:20:45 +0000 (18:20 +0100)
committerOleg Nesterov <oleg@redhat.com>
Fri, 8 Feb 2013 17:10:17 +0000 (18:10 +0100)
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>
kernel/trace/trace_uprobe.c

index 17d9b2bcc28d2e33b024c66c3c080caecd785d7b..06c22bad776a1f7e616e58c3947ca2cb35781541 100644 (file)
@@ -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;