On Saturday 15 September 2007, Andrew Morton wrote:Both of those call sites have code to handle procfs rejecting the file creation; nothing to fix. And anyway, there's no way this is a *caller* bug! The missing step seems to be that proc_register() doesn't bother to check whether there's already an entry for that file. Which is what the appended *UNTESTED* patch does (it compiles though). - Dave --- g26.orig/fs/proc/generic.c 2007-09-18 22:08:44.000000000 -0700 +++ g26/fs/proc/generic.c 2007-09-18 22:14:07.000000000 -0700 @@ -521,10 +521,11 @@ static const struct inode_operations pro .setattr = proc_notify_change, }; -static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp) +static int proc_register(struct proc_dir_entry *dir, struct proc_dir_entry *dp) { unsigned int i; - + struct proc_dir_entry *de; + i = get_inode_number(); if (i == 0) return -EAGAIN; @@ -547,6 +548,16 @@ static int proc_register(struct proc_dir } spin_lock(&proc_subdir_lock); + + for (de = dir->subdir; de ; de = de->next) { + if (de->namelen != dp->namelen) + continue; + if (!memcmp(de->name, dp->name, de->namelen)) { + spin_unlock(&proc_subdir_lock); + return -EEXIST; + } + } + dp->next = dir->subdir; dp->parent = dir; dir->subdir = dp; -
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
| Arjan van de Ven | Re: Linux 2.6.27-rc8 |
git: | |
| Arjan van de Ven | Re: [GIT]: Networking |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Jeff Garzik | Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
