summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-11-05 16:55:21 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2013-11-05 16:55:21 +1100
commit2051a80c88b54a3254b867b110b54a578011cf77 (patch)
tree759acafbd53804d74e9e43fd8b179372bc2dd8d5 /fs
parent80263a5053752d61da10e1dce5b34fa1ff824d0b (diff)
anon_inodefs: forbid open via /proc
open("/proc/pid/$anon-fd") should fail, we can't create the new file with correct f_op/etc correctly. Currently this creates the bogus file with the empty anon_inode_fops, this is harmless but still wrong and misleading. Add anon_inode_fops->anon_open() which simply returns ENXIO like sock_no_open() does in this case. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/anon_inodes.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 85c961849953..0cfbe066a00e 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -24,7 +24,15 @@
static struct vfsmount *anon_inode_mnt __read_mostly;
static struct inode *anon_inode_inode;
-static const struct file_operations anon_inode_fops;
+
+static int anon_open(struct inode *inode, struct file *file)
+{
+ return -ENXIO;
+}
+
+static const struct file_operations anon_inode_fops = {
+ .open = anon_open,
+};
/*
* anon_inodefs_dname() is called from d_path().