[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101210173533.GB2505@redhat.com>
Date: Fri, 10 Dec 2010 12:35:33 -0500
From: Dave Jones <davej@...hat.com>
To: Dan Carpenter <error27@...il.com>,
Marek Belisko <marek.belisko@...n-nandra.com>,
Greg Kroah-Hartman <gregkh@...e.de>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
Andy Whitcroft <apw@...onical.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 1/8] staging: ft1000: Convert char device to debugfs.
On Thu, Dec 09, 2010 at 01:43:36PM +0300, Dan Carpenter wrote:
> > + file = debugfs_create_file("device", S_IRUGO | S_IWUGO, dir,
> ^^^^^^^
> > + NULL, &ft1000fops);
>
> Don't make this world writeable.
we should probably make checkpatch catch this.
Exporting world writable sysfs/debugfs files is usually a bad thing.
Warn about it.
Signed-off-by: Dave Jones <davej@...hat.com>
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e3c7fc0..5075005 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2892,6 +2892,11 @@ sub process {
ERROR("lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr);
}
}
+
+ if ($line =~ /debugfs_create_file.*S_IWUGO/ ||
+ $line =~ /DEVICE_ATTR.*S_IWUGO/ ) {
+ WARN("Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr);
+ }
}
# If we have no input at all, then there is nothing to report on
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists