X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fproc%2Fgeneric.c;h=72ddf0faa71813ad5c34e4aeec87166560fe488f;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=e77cf186e2083ecca38ccb70b4209efb306af70c;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/fs/proc/generic.c b/fs/proc/generic.c index e77cf186e..72ddf0faa 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -18,10 +18,9 @@ #include #include #include -#include +#include #include #include -#include static ssize_t proc_file_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos); @@ -62,7 +61,7 @@ proc_file_read(struct file *file, char __user *buf, size_t nbytes, return -ENOMEM; while ((nbytes > 0) && !eof) { - count = min_t(ssize_t, PROC_BLOCK_SIZE, nbytes); + count = min_t(size_t, PROC_BLOCK_SIZE, nbytes); start = NULL; if (dp->get_info) { @@ -288,7 +287,7 @@ static int xlate_proc_name(const char *name, } static DEFINE_IDR(proc_inum_idr); -static spinlock_t proc_inum_lock = SPIN_LOCK_UNLOCKED; /* protects the above */ +static DEFINE_SPINLOCK(proc_inum_lock); /* protects the above */ #define PROC_DYNAMIC_FIRST 0xF0000000UL @@ -353,15 +352,8 @@ static int proc_delete_dentry(struct dentry * dentry) return 1; } -static int proc_revalidate_dentry(struct dentry *de, struct nameidata *nd) -{ - /* maybe add a check if it's really necessary? */ - return 0; -} - static struct dentry_operations proc_dentry_operations = { - .d_revalidate = proc_revalidate_dentry, .d_delete = proc_delete_dentry, }; @@ -388,7 +380,8 @@ struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry, struct nam error = -EINVAL; inode = proc_get_inode(dir->i_sb, ino, de); - inode->i_xid = vx_current_xid(); + /* generic proc entries belong to the host */ + inode->i_xid = 0; break; } } @@ -566,6 +559,11 @@ static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent, if (!(*parent) && xlate_proc_name(name, parent, &fn) != 0) goto out; + + /* At this point there must not be any '/' characters beyond *fn */ + if (strchr(fn, '/')) + goto out; + len = strlen(fn); ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);