aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/generic.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-09-11 08:46:53 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-09-11 08:46:53 -0400
commit336879b1da97fffc097f77c6d6f818660f2826f0 (patch)
tree4ddb4d1c5d2b67fb096c72e41d2a03b01a605041 /fs/proc/generic.c
parent3d3cbd84300e7be1e53083cac0f6f9c12978ecb4 (diff)
parentfdcaa1dbb7c6ed419b10fb8cdb5001ab0a00538f (diff)
Merge remote-tracking branch 'airlied/drm-next' into topic/vblank-rework
Dave asked me to do the backmerge before sending him the revised pull request, so here we go. Nothing fancy in the conflicts, just a few things changed right next to each another. Conflicts: drivers/gpu/drm/drm_irq.c Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'fs/proc/generic.c')
-rw-r--r--fs/proc/generic.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index b7f268eb5f45..317b72641ebf 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -27,7 +27,7 @@
27 27
28#include "internal.h" 28#include "internal.h"
29 29
30DEFINE_SPINLOCK(proc_subdir_lock); 30static DEFINE_SPINLOCK(proc_subdir_lock);
31 31
32static int proc_match(unsigned int len, const char *name, struct proc_dir_entry *de) 32static int proc_match(unsigned int len, const char *name, struct proc_dir_entry *de)
33{ 33{
@@ -330,28 +330,28 @@ static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
330 nlink_t nlink) 330 nlink_t nlink)
331{ 331{
332 struct proc_dir_entry *ent = NULL; 332 struct proc_dir_entry *ent = NULL;
333 const char *fn = name; 333 const char *fn;
334 unsigned int len; 334 struct qstr qstr;
335
336 /* make sure name is valid */
337 if (!name || !strlen(name))
338 goto out;
339 335
340 if (xlate_proc_name(name, parent, &fn) != 0) 336 if (xlate_proc_name(name, parent, &fn) != 0)
341 goto out; 337 goto out;
338 qstr.name = fn;
339 qstr.len = strlen(fn);
340 if (qstr.len == 0 || qstr.len >= 256) {
341 WARN(1, "name len %u\n", qstr.len);
342 return NULL;
343 }
344 if (*parent == &proc_root && name_to_int(&qstr) != ~0U) {
345 WARN(1, "create '/proc/%s' by hand\n", qstr.name);
346 return NULL;
347 }
342 348
343 /* At this point there must not be any '/' characters beyond *fn */ 349 ent = kzalloc(sizeof(struct proc_dir_entry) + qstr.len + 1, GFP_KERNEL);
344 if (strchr(fn, '/'))
345 goto out;
346
347 len = strlen(fn);
348
349 ent = kzalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
350 if (!ent) 350 if (!ent)
351 goto out; 351 goto out;
352 352
353 memcpy(ent->name, fn, len + 1); 353 memcpy(ent->name, fn, qstr.len + 1);
354 ent->namelen = len; 354 ent->namelen = qstr.len;
355 ent->mode = mode; 355 ent->mode = mode;
356 ent->nlink = nlink; 356 ent->nlink = nlink;
357 atomic_set(&ent->count, 1); 357 atomic_set(&ent->count, 1);