open("/proc/pid/$anon-fd") should fail, we can't create the new file with correctly. Currently this creates the bogus file with ->f_op == empty_fops copied from ->i_fop, this is harmless but still wrong and misleading. Now that anon_inode_fops has gone away we can add empty_no_open() to disallow this. This affects anon_inode_getfile() and the new aio_private_file(). Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx> --- fs/inode.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 4bcdad3..b7c159c 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -114,6 +114,11 @@ int proc_nr_inodes(ctl_table *table, int write, } #endif +static int empty_no_open(struct inode *inode, struct file *file) +{ + return -ENXIO; +} + /** * inode_init_always - perform inode structure intialisation * @sb: superblock inode belongs to @@ -124,8 +129,10 @@ int proc_nr_inodes(ctl_table *table, int write, */ int inode_init_always(struct super_block *sb, struct inode *inode) { + static const struct file_operations empty_fops = { + .open = empty_no_open, + }; static const struct inode_operations empty_iops; - static const struct file_operations empty_fops; struct address_space *const mapping = &inode->i_data; inode->i_sb = sb; -- 1.5.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-next" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html