From: Oleg Nesterov Date: Sun, 27 Jan 2013 17:20:45 +0000 (+0100) Subject: uprobes/tracing: Fix dentry/mount leak in create_trace_uprobe() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=84d7ed799fd6c1366547d88ddb8188c65de3b94f;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git uprobes/tracing: Fix dentry/mount leak in create_trace_uprobe() 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 Acked-by: Srikar Dronamraju --- diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 17d9b2bcc28..06c22bad776 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -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;