proc: return -ENOMEM when inode allocation failed
authoryan <clouds.yan@gmail.com>
Fri, 5 Oct 2012 00:15:38 +0000 (17:15 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Oct 2012 18:05:17 +0000 (03:05 +0900)
If proc_get_inode() returns NULL then presumably it encountered memory
exhaustion.  proc_lookup_de() should return -ENOMEM in this case, not
-EINVAL.

Signed-off-by: yan <clouds.yan@gmail.com>
Cc: Ryan Mallon <rmallon@gmail.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/generic.c

index b3647fe6a60870e55f36710497fd9dff583963ee..9e8f631643094a4e82c410c3d1ae5194b2dbe8e5 100644 (file)
@@ -427,7 +427,7 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir,
                if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
                        pde_get(de);
                        spin_unlock(&proc_subdir_lock);
-                       error = -EINVAL;
+                       error = -ENOMEM;
                        inode = proc_get_inode(dir->i_sb, de);
                        goto out_unlock;
                }