1. 27 Jul, 2020 2 commits
    • Amir Goldstein's avatar
      fsnotify: create method handle_inode_event() in fsnotify_operations · b9a1b977
      Amir Goldstein authored
      The method handle_event() grew a lot of complexity due to the design of
      fanotify and merging of ignore masks.
      
      Most backends do not care about this complex functionality, so we can hide
      this complexity from them.
      
      Introduce a method handle_inode_event() that serves those backends and
      passes a single inode mark and less arguments.
      
      This change converts all backends except fanotify and inotify to use the
      simplified handle_inode_event() method.  In pricipal, inotify could have
      also used the new method, but that would require passing more arguments
      on the simple helper (data, data_type, cookie), so we leave it with the
      handle_event() method.
      
      Link: https://lore.kernel.org/r/20200722125849.17418-9-amir73il@gmail.com
      
      Suggested-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      b9a1b977
    • Amir Goldstein's avatar
      fsnotify: pass dir argument to handle_event() callback · b54cecf5
      Amir Goldstein authored
      
      The 'inode' argument to handle_event(), sometimes referred to as
      'to_tell' is somewhat obsolete.
      It is a remnant from the times when a group could only have an inode mark
      associated with an event.
      
      We now pass an iter_info array to the callback, with all marks associated
      with an event.
      
      Most backends ignore this argument, with two exceptions:
      1. dnotify uses it for sanity check that event is on directory
      2. fanotify uses it to report fid of directory on directory entry
         modification events
      
      Remove the 'inode' argument and add a 'dir' argument.
      The callback function signature is deliberately changed, because
      the meaning of the argument has changed and the arguments have
      been documented.
      
      The 'dir' argument is set to when 'file_name' is specified and it is
      referring to the directory that the 'file_name' entry belongs to.
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      b54cecf5
  2. 17 Jun, 2020 1 commit
    • Gustavo A. R. Silva's avatar
      audit: Use struct_size() helper in alloc_chunk · bbccc11b
      Gustavo A. R. Silva authored
      
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array. For example:
      
      struct audit_chunk {
      	...
              struct node {
                      struct list_head list;
                      struct audit_tree *owner;
                      unsigned index;         /* index; upper bit indicates 'will prune' */
              } owners[];
      };
      
      Make use of the struct_size() helper instead of an open-coded version
      in order to avoid any potential type mistakes.
      
      So, replace the following form:
      
      offsetof(struct audit_chunk, owners) + count * sizeof(struct node);
      
      with:
      
      struct_size(chunk, owners, count)
      
      This code was detected with the help of Coccinelle.
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      bbccc11b
  3. 26 Apr, 2019 1 commit
  4. 14 Jan, 2019 1 commit
  5. 26 Nov, 2018 1 commit
  6. 12 Nov, 2018 14 commits
  7. 28 Jun, 2018 1 commit
  8. 27 Jun, 2018 1 commit
  9. 18 May, 2018 2 commits
  10. 23 Feb, 2018 1 commit
  11. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard...
      b2441318
  12. 31 Oct, 2017 1 commit
  13. 02 May, 2017 1 commit
  14. 10 Apr, 2017 7 commits
  15. 05 Apr, 2017 1 commit
  16. 03 Jan, 2017 1 commit
    • Jan Kara's avatar
      audit: Fix sleep in atomic · be29d20f
      Jan Kara authored
      
      Audit tree code was happily adding new notification marks while holding
      spinlocks. Since fsnotify_add_mark() acquires group->mark_mutex this can
      lead to sleeping while holding a spinlock, deadlocks due to lock
      inversion, and probably other fun. Fix the problem by acquiring
      group->mark_mutex earlier.
      
      CC: Paul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      be29d20f
  17. 23 Dec, 2016 1 commit
    • Jan Kara's avatar
      fsnotify: Remove fsnotify_duplicate_mark() · e3ba7307
      Jan Kara authored
      
      There are only two calls sites of fsnotify_duplicate_mark(). Those are
      in kernel/audit_tree.c and both are bogus. Vfsmount pointer is unused
      for audit tree, inode pointer and group gets set in
      fsnotify_add_mark_locked() later anyway, mask and free_mark are already
      set in alloc_chunk(). In fact, calling fsnotify_duplicate_mark() is
      actively harmful because following fsnotify_add_mark_locked() will leak
      group reference by overwriting the group pointer. So just remove the two
      calls to fsnotify_duplicate_mark() and the function.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      [PM: line wrapping to fit in 80 chars]
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      e3ba7307
  18. 05 Dec, 2016 1 commit
  19. 20 Nov, 2016 1 commit