All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Dan Carpenter <error27@gmail.com>,
	Marek Belisko <marek.belisko@open-nandra.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Andy Whitcroft <apw@canonical.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/8] staging: ft1000: Convert char device to debugfs.
Date: Fri, 10 Dec 2010 12:35:33 -0500	[thread overview]
Message-ID: <20101210173533.GB2505@redhat.com> (raw)
In-Reply-To: <20101209104336.GT10623@bicker>

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@redhat.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

  reply	other threads:[~2010-12-10 17:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-09 10:26 [PATCH 0/8] Use debugfs for debugging purposes Marek Belisko
2010-12-09 10:26 ` [PATCH 1/8] staging: ft1000: Convert char device to debugfs Marek Belisko
2010-12-09 10:43   ` Dan Carpenter
2010-12-10 17:35     ` Dave Jones [this message]
2010-12-10 18:04       ` Greg KH
2010-12-09 10:26 ` [PATCH 2/8] staging: ft1000: Fix private data pointer usage Marek Belisko
2010-12-09 10:26 ` [PATCH 3/8] staging: ft1000: Remove unused pdevobj array Marek Belisko
2010-12-09 10:26 ` [PATCH 4/8] staging: ft1000: Remove unused variable Marek Belisko
2010-12-09 10:26 ` [PATCH 5/8] staging: ft1000: Fix camelcase functions and variables Marek Belisko
2010-12-09 10:26 ` [PATCH 6/8] staging: ft1000: Remove dead code Marek Belisko
2010-12-09 10:26 ` [PATCH 7/8] staging: ft1000: Remove unused headers Marek Belisko
2010-12-09 10:26 ` [PATCH 8/8] staging: ft1000: Fix debug messages Marek Belisko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101210173533.GB2505@redhat.com \
    --to=davej@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=error27@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marek.belisko@open-nandra.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.