1. 27 Nov, 2023 4 commits
    • Johannes Berg's avatar
      wifi: cfg80211: add locked debugfs wrappers · b590b9ae
      Johannes Berg authored
      Add wrappers for debugfs files that should be called with
      the wiphy mutex held, while the file is also to be removed
      under the wiphy mutex. This could otherwise deadlock when
      a file is trying to acquire the wiphy mutex while the code
      removing it holds the mutex but waits for the removal.
      
      This actually works by pushing the execution of the read
      or write handler to a wiphy work that can be cancelled
      using the debugfs cancellation API.
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      b590b9ae
    • Johannes Berg's avatar
      debugfs: add API to allow debugfs operations cancellation · 8c88a474
      Johannes Berg authored
      In some cases there might be longer-running hardware accesses
      in debugfs files, or attempts to acquire locks, and we want
      to still be able to quickly remove the files.
      
      Introduce a cancellations API to use inside the debugfs handler
      functions to be able to cancel such operations on a per-file
      basis.
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      8c88a474
    • Johannes Berg's avatar
      debugfs: annotate debugfs handlers vs. removal with lockdep · f4acfcd4
      Johannes Berg authored
      When you take a lock in a debugfs handler but also try
      to remove the debugfs file under that lock, things can
      deadlock since the removal has to wait for all users
      to finish.
      
      Add lockdep annotations in debugfs_file_get()/_put()
      to catch such issues.
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      f4acfcd4
    • Johannes Berg's avatar
      debugfs: fix automount d_fsdata usage · 0ed04a18
      Johannes Berg authored
      debugfs_create_automount() stores a function pointer in d_fsdata,
      but since commit 7c8d4698 ("debugfs: add support for more
      elaborate ->d_fsdata") debugfs_release_dentry() will free it, now
      conditionally on DEBUGFS_FSDATA_IS_REAL_FOPS_BIT, but that's not
      set for the function pointer in automount. As a result, removing
      an automount dentry would attempt to free the function pointer.
      Luckily, the only user of this (tracing) never removes it.
      
      Nevertheless, it's safer if we just handle the fsdata in one way,
      namely either DEBUGFS_FSDATA_IS_REAL_FOPS_BIT or allocated. Thus,
      change the automount to allocate it, and use the real_fops in the
      data to indicate whether or not automount is filled, rather than
      adding a type tag. At least for now this isn't actually needed,
      but the next changes will require it.
      
      Also check in debugfs_file_get() that it gets only called
      on regular files, just to make things clearer.
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      0ed04a18
  2. 24 Nov, 2023 7 commits
  3. 22 Nov, 2023 1 commit
  4. 08 Nov, 2023 1 commit
  5. 28 Oct, 2023 4 commits
  6. 27 Oct, 2023 23 commits