From: Chris Wright <chris@wirex.com>
To: linux-kernel@vger.kernel.org
Cc: alan@lxorguk.ukuu.org.uk, torvalds@transmeta.com
Subject: [PATCH] minor code duplication in fs/proc/base.c
Date: Wed, 10 Oct 2001 17:27:27 -0700 [thread overview]
Message-ID: <20011010172727.H21401@figure1.int.wirex.com> (raw)
While looking through the proc code I noticed the standard_permission()
function is essentially the same as vfs_permission(). It appears there
is no need to maintain this code separately. For example, the recent
tweaks in vfs_permission() didn't make it into standard_permission().
If it helps, here is a patch. It is against 2.4.11, but it applies
cleanly 2.4.10-ac11.
thanks,
-chris
--- linux-2.4.11/fs/proc/base.c Fri Jul 20 12:39:56 2001
+++ linux-2.4.11-proc/fs/proc/base.c Wed Oct 10 17:10:25 2001
@@ -184,29 +184,6 @@
/* permission checks */
-static int standard_permission(struct inode *inode, int mask)
-{
- int mode = inode->i_mode;
-
- if ((mask & S_IWOTH) && IS_RDONLY(inode) &&
- (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
- return -EROFS; /* Nobody gets write access to a read-only fs */
- else if ((mask & S_IWOTH) && IS_IMMUTABLE(inode))
- return -EACCES; /* Nobody gets write access to an immutable file */
- else if (current->fsuid == inode->i_uid)
- mode >>= 6;
- else if (in_group_p(inode->i_gid))
- mode >>= 3;
- if (((mode & mask & S_IRWXO) == mask) || capable(CAP_DAC_OVERRIDE))
- return 0;
- /* read and search access */
- if ((mask == S_IROTH) ||
- (S_ISDIR(mode) && !(mask & ~(S_IROTH | S_IXOTH))))
- if (capable(CAP_DAC_READ_SEARCH))
- return 0;
- return -EACCES;
-}
-
static int proc_check_root(struct inode *inode)
{
struct dentry *de, *base, *root;
@@ -249,7 +226,7 @@
static int proc_permission(struct inode *inode, int mask)
{
- if (standard_permission(inode, mask) != 0)
+ if (vfs_permission(inode, mask) != 0)
return -EACCES;
return proc_check_root(inode);
}
reply other threads:[~2001-10-11 0:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20011010172727.H21401@figure1.int.wirex.com \
--to=chris@wirex.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®