In create_fd() we check if mount and dentry of the passed event are NULL.
This cant happen any more since we dont call this function for the overflow
event any longer. So we can remove this check.
Signed-off-by: Lino Sanfilippo <[email protected]>
---
fs/notify/fanotify/fanotify_user.c | 35 +++++++++++++++--------------------
1 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index e108960..0dce0d4 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -82,28 +82,23 @@ static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event)
*/
dentry = dget(event->path.dentry);
mnt = mntget(event->path.mnt);
- /* it's possible this event was an overflow event. in that case dentry and mnt
- * are NULL; That's fine, just don't call dentry open */
- if (dentry && mnt) {
- flags = group->fanotify_data.f_flags;
+
+ flags = group->fanotify_data.f_flags;
+ new_file = dentry_open(dentry, mnt, flags, current_cred());
+ /*
+ * Attempt fallback to read-only access if writable was not possible
+ * in order to at least provide something to the listener.
+ */
+ if (IS_ERR(new_file) && group->fanotify_data.readonly_fallback) {
+ /* dentry_open() put our refs, so get them again... */
+ dentry = dget(event->path.dentry);
+ mnt = mntget(event->path.mnt);
+
+ flags &= ~O_ACCMODE;
+ flags |= O_RDONLY;
new_file = dentry_open(dentry, mnt, flags, current_cred());
- /*
- * Attempt fallback to read-only access if writable was not possible
- * in order to at least provide something to the listener.
- */
- if (IS_ERR(new_file) && group->fanotify_data.readonly_fallback) {
- /* dentry_open() put our refs, so get them again... */
- dentry = dget(event->path.dentry);
- mnt = mntget(event->path.mnt);
-
- flags &= ~O_ACCMODE;
- flags |= O_RDONLY;
- new_file = dentry_open(dentry, mnt, flags,
- current_cred());
- }
- } else {
- new_file = ERR_PTR(-EOVERFLOW);
}
+
if (IS_ERR(new_file)) {
/*
* we still send an event even if we can't open the file. this
--
1.5.6.5