Merge tag 'nfs-for-5.7-5' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
[linux-2.6-microblaze.git] / kernel / audit_watch.c
index 8a8fd73..e09c551 100644 (file)
@@ -471,25 +471,13 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
                                    struct fsnotify_iter_info *iter_info)
 {
        struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info);
-       const struct inode *inode;
+       const struct inode *inode = fsnotify_data_inode(data, data_type);
        struct audit_parent *parent;
 
        parent = container_of(inode_mark, struct audit_parent, mark);
 
        BUG_ON(group != audit_watch_group);
-
-       switch (data_type) {
-       case (FSNOTIFY_EVENT_PATH):
-               inode = d_backing_inode(((const struct path *)data)->dentry);
-               break;
-       case (FSNOTIFY_EVENT_INODE):
-               inode = (const struct inode *)data;
-               break;
-       default:
-               BUG();
-               inode = NULL;
-               break;
-       }
+       WARN_ON(!inode);
 
        if (mask & (FS_CREATE|FS_MOVED_TO) && inode)
                audit_update_watch(parent, dname, inode->i_sb->s_dev, inode->i_ino, 0);