linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: linus@osdl.org, akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] protect against buggy drivers
Date: Fri, 08 Oct 2004 09:53:41 -0700	[thread overview]
Message-ID: <1097254421.16787.27.camel@localhost.localdomain> (raw)

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/10/08 09:52:03-07:00 shemminger@zqx3.pdx.osdl.net 
#   Protect against bad driver writers who pass invalid names when
#   setting up character devices.
# 
# fs/char_dev.c
#   2004/10/08 09:51:52-07:00 shemminger@zqx3.pdx.osdl.net +5 -0
#   Protect against bad driver writers who pass invalid names when
#   setting up character devices.
# 
diff -Nru a/fs/char_dev.c b/fs/char_dev.c
--- a/fs/char_dev.c	2004-10-08 09:52:15 -07:00
+++ b/fs/char_dev.c	2004-10-08 09:52:15 -07:00
@@ -196,6 +196,11 @@
 	char *s;
 	int err = -ENOMEM;
 
+	if (name == NULL || *name == '\0' || 
+	    strlen(name) >= KOBJ_NAME_LEN || 
+	    !strcmp(name, ".") || !strcmp(name, ".."))
+		return -EINVAL;
+
 	cd = __register_chrdev_region(major, 0, 256, name);
 	if (IS_ERR(cd))
 		return PTR_ERR(cd);



             reply	other threads:[~2004-10-08 16:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-08 16:53 Stephen Hemminger [this message]
2004-10-08 16:21 ` [PATCH] protect against buggy drivers Alan Cox
2004-10-08 17:14 ` Greg KH
2004-10-08 17:29   ` Richard B. Johnson
2004-10-08 17:50     ` Greg KH
2004-10-08 18:31       ` Richard B. Johnson
2004-10-08 18:35         ` Greg KH
2004-10-08 19:32       ` Richard B. Johnson
2004-10-08 18:27   ` Stephen Hemminger
2004-10-08 18:36     ` Greg KH
2004-10-22 20:58     ` Greg KH

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=1097254421.16787.27.camel@localhost.localdomain \
    --to=shemminger@osdl.org \
    --cc=akpm@osdl.org \
    --cc=linus@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).