From: James Morris Date: Thu, 4 Dec 2008 06:16:36 +0000 (+1100) Subject: Merge branch 'master' into next X-Git-Tag: v2.6.29-rc1~577^2^2~8 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=ec98ce480ada787f2cfbd696980ff3564415505b;p=linux-2.6-block.git Merge branch 'master' into next Conflicts: fs/nfsd/nfs4recover.c Manually fixed above to use new creds API functions, e.g. nfs4_save_creds(). Signed-off-by: James Morris --- ec98ce480ada787f2cfbd696980ff3564415505b diff --cc fs/nfsd/nfs4recover.c index 9371ea12d7fa,b79ec930d9f1..0f9d6efaa62b --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@@ -230,12 -224,10 +230,13 @@@ nfsd4_list_rec_dir(struct dentry *dir, if (!rec_dir_init) return 0; - nfs4_save_user(&uid, &gid); + status = nfs4_save_creds(&original_cred); + if (status < 0) + return status; + INIT_LIST_HEAD(dentries); - filp = dentry_open(dget(dir), mntget(rec_dir.mnt), O_RDONLY); + filp = dentry_open(dget(dir), mntget(rec_dir.mnt), O_RDONLY, + current_cred()); status = PTR_ERR(filp); if (IS_ERR(filp)) goto out; diff --cc include/linux/security.h index 59a11e19b617,e3d4ecda2673..6423abf1ac0f --- a/include/linux/security.h +++ b/include/linux/security.h @@@ -1800,32 -1822,45 +1801,35 @@@ static inline int security_vm_enough_me return cap_vm_enough_memory(current->mm, pages); } - static inline int security_vm_enough_memory_kern(long pages) + static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) { - return cap_vm_enough_memory(current->mm, pages); + WARN_ON(mm == NULL); + return cap_vm_enough_memory(mm, pages); } - static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) + static inline int security_vm_enough_memory_kern(long pages) { - return cap_vm_enough_memory(mm, pages); + /* If current->mm is a kernel thread then we will pass NULL, + for this specific case that is fine */ + return cap_vm_enough_memory(current->mm, pages); } -static inline int security_bprm_alloc(struct linux_binprm *bprm) -{ - return 0; -} - -static inline void security_bprm_free(struct linux_binprm *bprm) -{ } - -static inline void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe) +static inline int security_bprm_set_creds(struct linux_binprm *bprm) { - cap_bprm_apply_creds(bprm, unsafe); + return cap_bprm_set_creds(bprm); } -static inline void security_bprm_post_apply_creds(struct linux_binprm *bprm) +static inline int security_bprm_check(struct linux_binprm *bprm) { - return; + return 0; } -static inline int security_bprm_set(struct linux_binprm *bprm) +static inline void security_bprm_committing_creds(struct linux_binprm *bprm) { - return cap_bprm_set_security(bprm); } -static inline int security_bprm_check(struct linux_binprm *bprm) +static inline void security_bprm_committed_creds(struct linux_binprm *bprm) { - return 0; } static inline int security_bprm_secureexec(struct linux_binprm *bprm)