Commit 88f8831c055858179a7844d9dd4ddd7d3621322e

Authored by Dave Jones
Committed by Linus Torvalds
1 parent c023e4734c

checkpatch: check for world-writeable sysfs/debugfs files

Exporting world writable sysfs/debugfs files is usually a bad thing.  Warn
about it.

Signed-off-by: Dave Jones <davej@redhat.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff

scripts/checkpatch.pl
... ... @@ -2897,6 +2897,11 @@
2897 2897 ERROR("lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr);
2898 2898 }
2899 2899 }
  2900 +
  2901 + if ($line =~ /debugfs_create_file.*S_IWUGO/ ||
  2902 + $line =~ /DEVICE_ATTR.*S_IWUGO/ ) {
  2903 + WARN("Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr);
  2904 + }
2900 2905 }
2901 2906  
2902 2907 # If we have no input at all, then there is nothing to report on