Showing error 1755

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: fs/inotify_user.c
Line in file: 625
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-10 20:24:52 UTC


Source:

595        if (fd < 0)
596                return fd;
597
598        filp = get_empty_filp();
599        if (!filp) {
600                ret = -ENFILE;
601                goto out_put_fd;
602        }
603
604        user = get_uid(current->user);
605        if (unlikely(atomic_read(&user->inotify_devs) >=
606                        inotify_max_user_instances)) {
607                ret = -EMFILE;
608                goto out_free_uid;
609        }
610
611        dev = kmalloc(sizeof(struct inotify_device), GFP_KERNEL);
612        if (unlikely(!dev)) {
613                ret = -ENOMEM;
614                goto out_free_uid;
615        }
616
617        ih = inotify_init(&inotify_user_ops);
618        if (IS_ERR(ih)) {
619                ret = PTR_ERR(ih);
620                goto out_free_dev;
621        }
622        dev->ih = ih;
623        dev->fa = NULL;
624
625        filp->f_op = &inotify_fops;
626        filp->f_path.mnt = mntget(inotify_mnt);
627        filp->f_path.dentry = dget(inotify_mnt->mnt_root);
628        filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping;
629        filp->f_mode = FMODE_READ;
630        filp->f_flags = O_RDONLY | (flags & O_NONBLOCK);
631        filp->private_data = dev;
632
633        INIT_LIST_HEAD(&dev->events);
634        init_waitqueue_head(&dev->wq);
635        mutex_init(&dev->ev_mutex);
Show full sources