if (unlikely(!filp))
return -EBADF;
+ /* verify that this is indeed an inotify instance */
+ if (unlikely(filp->f_op != &inotify_fops)) {
+ ret = -EINVAL;
+ goto fput_and_out;
+ }
+
ret = find_inode(path, &nd);
if (unlikely(ret))
goto fput_and_out;
filp = fget_light(fd, &fput_needed);
if (unlikely(!filp))
return -EBADF;
+
+ /* verify that this is indeed an inotify instance */
+ if (unlikely(filp->f_op != &inotify_fops)) {
+ ret = -EINVAL;
+ goto out;
+ }
+
dev = filp->private_data;
ret = inotify_ignore(dev, wd);
- fput_light(filp, fput_needed);
+out:
+ fput_light(filp, fput_needed);
return ret;
}