linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erik Mouw <J.A.K.Mouw@ITS.TUDelft.NL>
To: Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: [PATCH] proc_mknod() should check the mode parameter
Date: Wed, 18 Apr 2001 22:28:26 +0200	[thread overview]
Message-ID: <20010418222826.N6985@arthur.ubicom.tudelft.nl> (raw)

Hi all,

While documenting the procfs interface (more of that later), I came
across proc_mknod() which is supposed to be used to create devices in
the procfs. IMHO it should therefore check if the mode parameter
contains S_IFBLK or S_IFCHR. Here is a patch (against linux-2.4.4-pre3)
to do that:

Index: fs/proc/generic.c
===================================================================
RCS file: /home/erik/cvsroot/elinux/fs/proc/generic.c,v
retrieving revision 1.1.1.16
diff -u -r1.1.1.16 generic.c
--- fs/proc/generic.c	2001/04/08 23:34:42	1.1.1.16
+++ fs/proc/generic.c	2001/04/18 20:20:39
@@ -445,6 +445,9 @@
 	const char *fn = name;
 	int len;
 
+	if (! (S_ISCHR(mode) || S_ISBLK(mode)))
+		goto out;
+
 	if (!parent && xlate_proc_name(name, &parent, &fn) != 0)
 		goto out;
 	len = strlen(fn);



Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2783635  Fax: +31-15-2781843  Email: J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/

             reply	other threads:[~2001-04-18 20:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-18 20:28 Erik Mouw [this message]
2001-04-18 21:51 ` [PATCH] proc_mknod() should check the mode parameter Alexander Viro
2001-04-18 21:56   ` Erik Mouw

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=20010418222826.N6985@arthur.ubicom.tudelft.nl \
    --to=j.a.k.mouw@its.tudelft.nl \
    --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).