* [9/11] hugetlb: move inode attributes into hugetlb_key
@ 2002-11-12 8:28 William Lee Irwin III
0 siblings, 0 replies; only message in thread
From: William Lee Irwin III @ 2002-11-12 8:28 UTC (permalink / raw)
To: linux-kernel
This patch moves uid/gid/mode/size fields used in struct inode and the
checks on them into key management code and structures.
hugetlbpage.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff -urpN htlb-2.5.47-8/arch/i386/mm/hugetlbpage.c htlb-2.5.47-9/arch/i386/mm/hugetlbpage.c
--- htlb-2.5.47-8/arch/i386/mm/hugetlbpage.c 2002-11-11 22:32:00.000000000 -0800
+++ htlb-2.5.47-9/arch/i386/mm/hugetlbpage.c 2002-11-11 22:42:23.000000000 -0800
@@ -33,6 +33,10 @@ struct hugetlb_key {
struct inode *in;
int key;
int busy;
+ uid_t uid;
+ gid_t gid;
+ umode_t mode;
+ loff_t size;
};
static struct hugetlb_key htlbpagek[MAX_ID];
@@ -63,7 +67,7 @@ static struct hugetlb_key *find_key(int
return NULL;
}
-static int check_size_prot(struct inode *inode, unsigned long len, int prot, int flag);
+static int check_size_prot(struct hugetlb_key *key, unsigned long len, int prot, int flag);
/*
* Call without htlbpage_lock, returns with htlbpage_lock held.
*/
@@ -105,6 +109,10 @@ struct hugetlb_key *alloc_key(int key, u
inode->i_gid = current->fsgid;
inode->i_mode = prot;
inode->i_size = len;
+ hugetlb_key->uid = current->fsuid;
+ hugetlb_key->gid = current->fsgid;
+ hugetlb_key->mode = prot;
+ hugetlb_key->size = len;
*new = 1;
}
}
@@ -112,7 +120,7 @@ struct hugetlb_key *alloc_key(int key, u
} else if (key_busy(hugetlb_key)) {
hugetlb_key = ERR_PTR(-EAGAIN);
spin_unlock(&htlbpage_lock);
- } else if (check_size_prot(hugetlb_key->in, len, prot, flag) < 0) {
+ } else if (check_size_prot(hugetlb_key, len, prot, flag) < 0) {
kfree(hugetlb_key->in);
hugetlb_key->key = 0;
hugetlb_key = ERR_PTR(-EINVAL);
@@ -360,13 +368,13 @@ void zap_hugepage_range(struct vm_area_s
spin_unlock(&mm->page_table_lock);
}
-static int check_size_prot(struct inode *inode, unsigned long len, int prot, int flag)
+static int check_size_prot(struct hugetlb_key *key, unsigned long len, int prot, int flag)
{
- if (inode->i_uid != current->fsuid)
+ if (key->uid != current->fsuid)
return -1;
- if (inode->i_gid != current->fsgid)
+ if (key->gid != current->fsgid)
return -1;
- if (inode->i_size != len)
+ if (key->size != len)
return -1;
return 0;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-11-12 8:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-12 8:28 [9/11] hugetlb: move inode attributes into hugetlb_key William Lee Irwin III
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®