0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/cache.h>
0009 #include <linux/time.h>
0010 #include <linux/proc_fs.h>
0011 #include <linux/kernel.h>
0012 #include <linux/pid_namespace.h>
0013 #include <linux/mm.h>
0014 #include <linux/string.h>
0015 #include <linux/stat.h>
0016 #include <linux/completion.h>
0017 #include <linux/poll.h>
0018 #include <linux/printk.h>
0019 #include <linux/file.h>
0020 #include <linux/limits.h>
0021 #include <linux/init.h>
0022 #include <linux/module.h>
0023 #include <linux/sysctl.h>
0024 #include <linux/seq_file.h>
0025 #include <linux/slab.h>
0026 #include <linux/mount.h>
0027 #include <linux/bug.h>
0028
0029 #include "internal.h"
0030
0031 static void proc_evict_inode(struct inode *inode)
0032 {
0033 struct proc_dir_entry *de;
0034 struct ctl_table_header *head;
0035 struct proc_inode *ei = PROC_I(inode);
0036
0037 truncate_inode_pages_final(&inode->i_data);
0038 clear_inode(inode);
0039
0040
0041 if (ei->pid) {
0042 proc_pid_evict_inode(ei);
0043 ei->pid = NULL;
0044 }
0045
0046
0047 de = ei->pde;
0048 if (de) {
0049 pde_put(de);
0050 ei->pde = NULL;
0051 }
0052
0053 head = ei->sysctl;
0054 if (head) {
0055 RCU_INIT_POINTER(ei->sysctl, NULL);
0056 proc_sys_evict_inode(inode, head);
0057 }
0058 }
0059
0060 static struct kmem_cache *proc_inode_cachep __ro_after_init;
0061 static struct kmem_cache *pde_opener_cache __ro_after_init;
0062
0063 static struct inode *proc_alloc_inode(struct super_block *sb)
0064 {
0065 struct proc_inode *ei;
0066
0067 ei = alloc_inode_sb(sb, proc_inode_cachep, GFP_KERNEL);
0068 if (!ei)
0069 return NULL;
0070 ei->pid = NULL;
0071 ei->fd = 0;
0072 ei->op.proc_get_link = NULL;
0073 ei->pde = NULL;
0074 ei->sysctl = NULL;
0075 ei->sysctl_entry = NULL;
0076 INIT_HLIST_NODE(&ei->sibling_inodes);
0077 ei->ns_ops = NULL;
0078 return &ei->vfs_inode;
0079 }
0080
0081 static void proc_free_inode(struct inode *inode)
0082 {
0083 kmem_cache_free(proc_inode_cachep, PROC_I(inode));
0084 }
0085
0086 static void init_once(void *foo)
0087 {
0088 struct proc_inode *ei = (struct proc_inode *) foo;
0089
0090 inode_init_once(&ei->vfs_inode);
0091 }
0092
0093 void __init proc_init_kmemcache(void)
0094 {
0095 proc_inode_cachep = kmem_cache_create("proc_inode_cache",
0096 sizeof(struct proc_inode),
0097 0, (SLAB_RECLAIM_ACCOUNT|
0098 SLAB_MEM_SPREAD|SLAB_ACCOUNT|
0099 SLAB_PANIC),
0100 init_once);
0101 pde_opener_cache =
0102 kmem_cache_create("pde_opener", sizeof(struct pde_opener), 0,
0103 SLAB_ACCOUNT|SLAB_PANIC, NULL);
0104 proc_dir_entry_cache = kmem_cache_create_usercopy(
0105 "proc_dir_entry", SIZEOF_PDE, 0, SLAB_PANIC,
0106 offsetof(struct proc_dir_entry, inline_name),
0107 SIZEOF_PDE_INLINE_NAME, NULL);
0108 BUILD_BUG_ON(sizeof(struct proc_dir_entry) >= SIZEOF_PDE);
0109 }
0110
0111 void proc_invalidate_siblings_dcache(struct hlist_head *inodes, spinlock_t *lock)
0112 {
0113 struct inode *inode;
0114 struct proc_inode *ei;
0115 struct hlist_node *node;
0116 struct super_block *old_sb = NULL;
0117
0118 rcu_read_lock();
0119 for (;;) {
0120 struct super_block *sb;
0121 node = hlist_first_rcu(inodes);
0122 if (!node)
0123 break;
0124 ei = hlist_entry(node, struct proc_inode, sibling_inodes);
0125 spin_lock(lock);
0126 hlist_del_init_rcu(&ei->sibling_inodes);
0127 spin_unlock(lock);
0128
0129 inode = &ei->vfs_inode;
0130 sb = inode->i_sb;
0131 if ((sb != old_sb) && !atomic_inc_not_zero(&sb->s_active))
0132 continue;
0133 inode = igrab(inode);
0134 rcu_read_unlock();
0135 if (sb != old_sb) {
0136 if (old_sb)
0137 deactivate_super(old_sb);
0138 old_sb = sb;
0139 }
0140 if (unlikely(!inode)) {
0141 rcu_read_lock();
0142 continue;
0143 }
0144
0145 if (S_ISDIR(inode->i_mode)) {
0146 struct dentry *dir = d_find_any_alias(inode);
0147 if (dir) {
0148 d_invalidate(dir);
0149 dput(dir);
0150 }
0151 } else {
0152 struct dentry *dentry;
0153 while ((dentry = d_find_alias(inode))) {
0154 d_invalidate(dentry);
0155 dput(dentry);
0156 }
0157 }
0158 iput(inode);
0159
0160 rcu_read_lock();
0161 }
0162 rcu_read_unlock();
0163 if (old_sb)
0164 deactivate_super(old_sb);
0165 }
0166
0167 static inline const char *hidepid2str(enum proc_hidepid v)
0168 {
0169 switch (v) {
0170 case HIDEPID_OFF: return "off";
0171 case HIDEPID_NO_ACCESS: return "noaccess";
0172 case HIDEPID_INVISIBLE: return "invisible";
0173 case HIDEPID_NOT_PTRACEABLE: return "ptraceable";
0174 }
0175 WARN_ONCE(1, "bad hide_pid value: %d\n", v);
0176 return "unknown";
0177 }
0178
0179 static int proc_show_options(struct seq_file *seq, struct dentry *root)
0180 {
0181 struct proc_fs_info *fs_info = proc_sb_info(root->d_sb);
0182
0183 if (!gid_eq(fs_info->pid_gid, GLOBAL_ROOT_GID))
0184 seq_printf(seq, ",gid=%u", from_kgid_munged(&init_user_ns, fs_info->pid_gid));
0185 if (fs_info->hide_pid != HIDEPID_OFF)
0186 seq_printf(seq, ",hidepid=%s", hidepid2str(fs_info->hide_pid));
0187 if (fs_info->pidonly != PROC_PIDONLY_OFF)
0188 seq_printf(seq, ",subset=pid");
0189
0190 return 0;
0191 }
0192
0193 const struct super_operations proc_sops = {
0194 .alloc_inode = proc_alloc_inode,
0195 .free_inode = proc_free_inode,
0196 .drop_inode = generic_delete_inode,
0197 .evict_inode = proc_evict_inode,
0198 .statfs = simple_statfs,
0199 .show_options = proc_show_options,
0200 };
0201
0202 enum {BIAS = -1U<<31};
0203
0204 static inline int use_pde(struct proc_dir_entry *pde)
0205 {
0206 return likely(atomic_inc_unless_negative(&pde->in_use));
0207 }
0208
0209 static void unuse_pde(struct proc_dir_entry *pde)
0210 {
0211 if (unlikely(atomic_dec_return(&pde->in_use) == BIAS))
0212 complete(pde->pde_unload_completion);
0213 }
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224 static void close_pdeo(struct proc_dir_entry *pde, struct pde_opener *pdeo)
0225 __releases(&pde->pde_unload_lock)
0226 {
0227
0228
0229
0230
0231
0232
0233
0234 if (pdeo->closing) {
0235
0236 DECLARE_COMPLETION_ONSTACK(c);
0237 pdeo->c = &c;
0238 spin_unlock(&pde->pde_unload_lock);
0239 wait_for_completion(&c);
0240 } else {
0241 struct file *file;
0242 struct completion *c;
0243
0244 pdeo->closing = true;
0245 spin_unlock(&pde->pde_unload_lock);
0246
0247 file = pdeo->file;
0248 pde->proc_ops->proc_release(file_inode(file), file);
0249
0250 spin_lock(&pde->pde_unload_lock);
0251
0252 list_del(&pdeo->lh);
0253 c = pdeo->c;
0254 spin_unlock(&pde->pde_unload_lock);
0255 if (unlikely(c))
0256 complete(c);
0257 kmem_cache_free(pde_opener_cache, pdeo);
0258 }
0259 }
0260
0261 void proc_entry_rundown(struct proc_dir_entry *de)
0262 {
0263 DECLARE_COMPLETION_ONSTACK(c);
0264
0265 de->pde_unload_completion = &c;
0266 if (atomic_add_return(BIAS, &de->in_use) != BIAS)
0267 wait_for_completion(&c);
0268
0269
0270
0271 spin_lock(&de->pde_unload_lock);
0272 while (!list_empty(&de->pde_openers)) {
0273 struct pde_opener *pdeo;
0274 pdeo = list_first_entry(&de->pde_openers, struct pde_opener, lh);
0275 close_pdeo(de, pdeo);
0276 spin_lock(&de->pde_unload_lock);
0277 }
0278 spin_unlock(&de->pde_unload_lock);
0279 }
0280
0281 static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence)
0282 {
0283 struct proc_dir_entry *pde = PDE(file_inode(file));
0284 loff_t rv = -EINVAL;
0285
0286 if (pde_is_permanent(pde)) {
0287 return pde->proc_ops->proc_lseek(file, offset, whence);
0288 } else if (use_pde(pde)) {
0289 rv = pde->proc_ops->proc_lseek(file, offset, whence);
0290 unuse_pde(pde);
0291 }
0292 return rv;
0293 }
0294
0295 static ssize_t proc_reg_read_iter(struct kiocb *iocb, struct iov_iter *iter)
0296 {
0297 struct proc_dir_entry *pde = PDE(file_inode(iocb->ki_filp));
0298 ssize_t ret;
0299
0300 if (pde_is_permanent(pde))
0301 return pde->proc_ops->proc_read_iter(iocb, iter);
0302
0303 if (!use_pde(pde))
0304 return -EIO;
0305 ret = pde->proc_ops->proc_read_iter(iocb, iter);
0306 unuse_pde(pde);
0307 return ret;
0308 }
0309
0310 static ssize_t pde_read(struct proc_dir_entry *pde, struct file *file, char __user *buf, size_t count, loff_t *ppos)
0311 {
0312 typeof_member(struct proc_ops, proc_read) read;
0313
0314 read = pde->proc_ops->proc_read;
0315 if (read)
0316 return read(file, buf, count, ppos);
0317 return -EIO;
0318 }
0319
0320 static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
0321 {
0322 struct proc_dir_entry *pde = PDE(file_inode(file));
0323 ssize_t rv = -EIO;
0324
0325 if (pde_is_permanent(pde)) {
0326 return pde_read(pde, file, buf, count, ppos);
0327 } else if (use_pde(pde)) {
0328 rv = pde_read(pde, file, buf, count, ppos);
0329 unuse_pde(pde);
0330 }
0331 return rv;
0332 }
0333
0334 static ssize_t pde_write(struct proc_dir_entry *pde, struct file *file, const char __user *buf, size_t count, loff_t *ppos)
0335 {
0336 typeof_member(struct proc_ops, proc_write) write;
0337
0338 write = pde->proc_ops->proc_write;
0339 if (write)
0340 return write(file, buf, count, ppos);
0341 return -EIO;
0342 }
0343
0344 static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
0345 {
0346 struct proc_dir_entry *pde = PDE(file_inode(file));
0347 ssize_t rv = -EIO;
0348
0349 if (pde_is_permanent(pde)) {
0350 return pde_write(pde, file, buf, count, ppos);
0351 } else if (use_pde(pde)) {
0352 rv = pde_write(pde, file, buf, count, ppos);
0353 unuse_pde(pde);
0354 }
0355 return rv;
0356 }
0357
0358 static __poll_t pde_poll(struct proc_dir_entry *pde, struct file *file, struct poll_table_struct *pts)
0359 {
0360 typeof_member(struct proc_ops, proc_poll) poll;
0361
0362 poll = pde->proc_ops->proc_poll;
0363 if (poll)
0364 return poll(file, pts);
0365 return DEFAULT_POLLMASK;
0366 }
0367
0368 static __poll_t proc_reg_poll(struct file *file, struct poll_table_struct *pts)
0369 {
0370 struct proc_dir_entry *pde = PDE(file_inode(file));
0371 __poll_t rv = DEFAULT_POLLMASK;
0372
0373 if (pde_is_permanent(pde)) {
0374 return pde_poll(pde, file, pts);
0375 } else if (use_pde(pde)) {
0376 rv = pde_poll(pde, file, pts);
0377 unuse_pde(pde);
0378 }
0379 return rv;
0380 }
0381
0382 static long pde_ioctl(struct proc_dir_entry *pde, struct file *file, unsigned int cmd, unsigned long arg)
0383 {
0384 typeof_member(struct proc_ops, proc_ioctl) ioctl;
0385
0386 ioctl = pde->proc_ops->proc_ioctl;
0387 if (ioctl)
0388 return ioctl(file, cmd, arg);
0389 return -ENOTTY;
0390 }
0391
0392 static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
0393 {
0394 struct proc_dir_entry *pde = PDE(file_inode(file));
0395 long rv = -ENOTTY;
0396
0397 if (pde_is_permanent(pde)) {
0398 return pde_ioctl(pde, file, cmd, arg);
0399 } else if (use_pde(pde)) {
0400 rv = pde_ioctl(pde, file, cmd, arg);
0401 unuse_pde(pde);
0402 }
0403 return rv;
0404 }
0405
0406 #ifdef CONFIG_COMPAT
0407 static long pde_compat_ioctl(struct proc_dir_entry *pde, struct file *file, unsigned int cmd, unsigned long arg)
0408 {
0409 typeof_member(struct proc_ops, proc_compat_ioctl) compat_ioctl;
0410
0411 compat_ioctl = pde->proc_ops->proc_compat_ioctl;
0412 if (compat_ioctl)
0413 return compat_ioctl(file, cmd, arg);
0414 return -ENOTTY;
0415 }
0416
0417 static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
0418 {
0419 struct proc_dir_entry *pde = PDE(file_inode(file));
0420 long rv = -ENOTTY;
0421 if (pde_is_permanent(pde)) {
0422 return pde_compat_ioctl(pde, file, cmd, arg);
0423 } else if (use_pde(pde)) {
0424 rv = pde_compat_ioctl(pde, file, cmd, arg);
0425 unuse_pde(pde);
0426 }
0427 return rv;
0428 }
0429 #endif
0430
0431 static int pde_mmap(struct proc_dir_entry *pde, struct file *file, struct vm_area_struct *vma)
0432 {
0433 typeof_member(struct proc_ops, proc_mmap) mmap;
0434
0435 mmap = pde->proc_ops->proc_mmap;
0436 if (mmap)
0437 return mmap(file, vma);
0438 return -EIO;
0439 }
0440
0441 static int proc_reg_mmap(struct file *file, struct vm_area_struct *vma)
0442 {
0443 struct proc_dir_entry *pde = PDE(file_inode(file));
0444 int rv = -EIO;
0445
0446 if (pde_is_permanent(pde)) {
0447 return pde_mmap(pde, file, vma);
0448 } else if (use_pde(pde)) {
0449 rv = pde_mmap(pde, file, vma);
0450 unuse_pde(pde);
0451 }
0452 return rv;
0453 }
0454
0455 static unsigned long
0456 pde_get_unmapped_area(struct proc_dir_entry *pde, struct file *file, unsigned long orig_addr,
0457 unsigned long len, unsigned long pgoff,
0458 unsigned long flags)
0459 {
0460 typeof_member(struct proc_ops, proc_get_unmapped_area) get_area;
0461
0462 get_area = pde->proc_ops->proc_get_unmapped_area;
0463 #ifdef CONFIG_MMU
0464 if (!get_area)
0465 get_area = current->mm->get_unmapped_area;
0466 #endif
0467 if (get_area)
0468 return get_area(file, orig_addr, len, pgoff, flags);
0469 return orig_addr;
0470 }
0471
0472 static unsigned long
0473 proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr,
0474 unsigned long len, unsigned long pgoff,
0475 unsigned long flags)
0476 {
0477 struct proc_dir_entry *pde = PDE(file_inode(file));
0478 unsigned long rv = -EIO;
0479
0480 if (pde_is_permanent(pde)) {
0481 return pde_get_unmapped_area(pde, file, orig_addr, len, pgoff, flags);
0482 } else if (use_pde(pde)) {
0483 rv = pde_get_unmapped_area(pde, file, orig_addr, len, pgoff, flags);
0484 unuse_pde(pde);
0485 }
0486 return rv;
0487 }
0488
0489 static int proc_reg_open(struct inode *inode, struct file *file)
0490 {
0491 struct proc_dir_entry *pde = PDE(inode);
0492 int rv = 0;
0493 typeof_member(struct proc_ops, proc_open) open;
0494 typeof_member(struct proc_ops, proc_release) release;
0495 struct pde_opener *pdeo;
0496
0497 if (!pde->proc_ops->proc_lseek)
0498 file->f_mode &= ~FMODE_LSEEK;
0499
0500 if (pde_is_permanent(pde)) {
0501 open = pde->proc_ops->proc_open;
0502 if (open)
0503 rv = open(inode, file);
0504 return rv;
0505 }
0506
0507
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517
0518 if (!use_pde(pde))
0519 return -ENOENT;
0520
0521 release = pde->proc_ops->proc_release;
0522 if (release) {
0523 pdeo = kmem_cache_alloc(pde_opener_cache, GFP_KERNEL);
0524 if (!pdeo) {
0525 rv = -ENOMEM;
0526 goto out_unuse;
0527 }
0528 }
0529
0530 open = pde->proc_ops->proc_open;
0531 if (open)
0532 rv = open(inode, file);
0533
0534 if (release) {
0535 if (rv == 0) {
0536
0537 pdeo->file = file;
0538 pdeo->closing = false;
0539 pdeo->c = NULL;
0540 spin_lock(&pde->pde_unload_lock);
0541 list_add(&pdeo->lh, &pde->pde_openers);
0542 spin_unlock(&pde->pde_unload_lock);
0543 } else
0544 kmem_cache_free(pde_opener_cache, pdeo);
0545 }
0546
0547 out_unuse:
0548 unuse_pde(pde);
0549 return rv;
0550 }
0551
0552 static int proc_reg_release(struct inode *inode, struct file *file)
0553 {
0554 struct proc_dir_entry *pde = PDE(inode);
0555 struct pde_opener *pdeo;
0556
0557 if (pde_is_permanent(pde)) {
0558 typeof_member(struct proc_ops, proc_release) release;
0559
0560 release = pde->proc_ops->proc_release;
0561 if (release) {
0562 return release(inode, file);
0563 }
0564 return 0;
0565 }
0566
0567 spin_lock(&pde->pde_unload_lock);
0568 list_for_each_entry(pdeo, &pde->pde_openers, lh) {
0569 if (pdeo->file == file) {
0570 close_pdeo(pde, pdeo);
0571 return 0;
0572 }
0573 }
0574 spin_unlock(&pde->pde_unload_lock);
0575 return 0;
0576 }
0577
0578 static const struct file_operations proc_reg_file_ops = {
0579 .llseek = proc_reg_llseek,
0580 .read = proc_reg_read,
0581 .write = proc_reg_write,
0582 .poll = proc_reg_poll,
0583 .unlocked_ioctl = proc_reg_unlocked_ioctl,
0584 .mmap = proc_reg_mmap,
0585 .get_unmapped_area = proc_reg_get_unmapped_area,
0586 .open = proc_reg_open,
0587 .release = proc_reg_release,
0588 };
0589
0590 static const struct file_operations proc_iter_file_ops = {
0591 .llseek = proc_reg_llseek,
0592 .read_iter = proc_reg_read_iter,
0593 .write = proc_reg_write,
0594 .splice_read = generic_file_splice_read,
0595 .poll = proc_reg_poll,
0596 .unlocked_ioctl = proc_reg_unlocked_ioctl,
0597 .mmap = proc_reg_mmap,
0598 .get_unmapped_area = proc_reg_get_unmapped_area,
0599 .open = proc_reg_open,
0600 .release = proc_reg_release,
0601 };
0602
0603 #ifdef CONFIG_COMPAT
0604 static const struct file_operations proc_reg_file_ops_compat = {
0605 .llseek = proc_reg_llseek,
0606 .read = proc_reg_read,
0607 .write = proc_reg_write,
0608 .poll = proc_reg_poll,
0609 .unlocked_ioctl = proc_reg_unlocked_ioctl,
0610 .compat_ioctl = proc_reg_compat_ioctl,
0611 .mmap = proc_reg_mmap,
0612 .get_unmapped_area = proc_reg_get_unmapped_area,
0613 .open = proc_reg_open,
0614 .release = proc_reg_release,
0615 };
0616
0617 static const struct file_operations proc_iter_file_ops_compat = {
0618 .llseek = proc_reg_llseek,
0619 .read_iter = proc_reg_read_iter,
0620 .splice_read = generic_file_splice_read,
0621 .write = proc_reg_write,
0622 .poll = proc_reg_poll,
0623 .unlocked_ioctl = proc_reg_unlocked_ioctl,
0624 .compat_ioctl = proc_reg_compat_ioctl,
0625 .mmap = proc_reg_mmap,
0626 .get_unmapped_area = proc_reg_get_unmapped_area,
0627 .open = proc_reg_open,
0628 .release = proc_reg_release,
0629 };
0630 #endif
0631
0632 static void proc_put_link(void *p)
0633 {
0634 unuse_pde(p);
0635 }
0636
0637 static const char *proc_get_link(struct dentry *dentry,
0638 struct inode *inode,
0639 struct delayed_call *done)
0640 {
0641 struct proc_dir_entry *pde = PDE(inode);
0642 if (!use_pde(pde))
0643 return ERR_PTR(-EINVAL);
0644 set_delayed_call(done, proc_put_link, pde);
0645 return pde->data;
0646 }
0647
0648 const struct inode_operations proc_link_inode_operations = {
0649 .get_link = proc_get_link,
0650 };
0651
0652 struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
0653 {
0654 struct inode *inode = new_inode(sb);
0655
0656 if (!inode) {
0657 pde_put(de);
0658 return NULL;
0659 }
0660
0661 inode->i_private = de->data;
0662 inode->i_ino = de->low_ino;
0663 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
0664 PROC_I(inode)->pde = de;
0665 if (is_empty_pde(de)) {
0666 make_empty_dir_inode(inode);
0667 return inode;
0668 }
0669
0670 if (de->mode) {
0671 inode->i_mode = de->mode;
0672 inode->i_uid = de->uid;
0673 inode->i_gid = de->gid;
0674 }
0675 if (de->size)
0676 inode->i_size = de->size;
0677 if (de->nlink)
0678 set_nlink(inode, de->nlink);
0679
0680 if (S_ISREG(inode->i_mode)) {
0681 inode->i_op = de->proc_iops;
0682 if (de->proc_ops->proc_read_iter)
0683 inode->i_fop = &proc_iter_file_ops;
0684 else
0685 inode->i_fop = &proc_reg_file_ops;
0686 #ifdef CONFIG_COMPAT
0687 if (de->proc_ops->proc_compat_ioctl) {
0688 if (de->proc_ops->proc_read_iter)
0689 inode->i_fop = &proc_iter_file_ops_compat;
0690 else
0691 inode->i_fop = &proc_reg_file_ops_compat;
0692 }
0693 #endif
0694 } else if (S_ISDIR(inode->i_mode)) {
0695 inode->i_op = de->proc_iops;
0696 inode->i_fop = de->proc_dir_ops;
0697 } else if (S_ISLNK(inode->i_mode)) {
0698 inode->i_op = de->proc_iops;
0699 inode->i_fop = NULL;
0700 } else {
0701 BUG();
0702 }
0703 return inode;
0704 }