From d2857e79a2ba7c155eaa1a7d3581c8d26b31e54e Mon Sep 17 00:00:00 2001 From: Daisuke Ogino Date: Tue, 26 Jul 2011 16:08:37 -0700 Subject: [PATCH] procfs: return ENOENT on opening a being-removed proc entry Change the return value to ENOENT. This return value is then returned when opening the proc entry that have been removed. For example, open("/proc/bus/pci/XX/YY") when the corresponding device is being hot-removed. Signed-off-by: Daisuke Ogino Cc: Jesse Barnes Acked-by: Alexey Dobriyan Cc: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/proc/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 74b48cfa1bb..7ed72d6c1c6 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -319,7 +319,7 @@ static int proc_reg_open(struct inode *inode, struct file *file) if (!pde->proc_fops) { spin_unlock(&pde->pde_unload_lock); kfree(pdeo); - return -EINVAL; + return -ENOENT; } pde->pde_users++; open = pde->proc_fops->open; -- 2.41.0