diff options
| -rw-r--r-- | arch/mips/kernel/vpe.c | 4 | ||||
| -rw-r--r-- | drivers/isdn/hysdn/hysdn_procconf.c | 6 | ||||
| -rw-r--r-- | fs/coda/file.c | 2 | ||||
| -rw-r--r-- | fs/file_table.c | 7 | ||||
| -rw-r--r-- | fs/hppfs/hppfs.c | 4 | ||||
| -rw-r--r-- | include/linux/fs.h | 2 | ||||
| -rw-r--r-- | net/ipv4/netfilter/ipt_LOG.c | 4 | ||||
| -rw-r--r-- | net/ipv6/netfilter/ip6t_LOG.c | 4 | ||||
| -rw-r--r-- | net/netfilter/nfnetlink_log.c | 5 | ||||
| -rw-r--r-- | net/netfilter/xt_owner.c | 16 | ||||
| -rw-r--r-- | net/sched/cls_flow.c | 4 |
11 files changed, 31 insertions, 27 deletions
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 972b2d2b8401..09786e496375 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
| @@ -1085,8 +1085,8 @@ static int vpe_open(struct inode *inode, struct file *filp) | |||
| 1085 | v->load_addr = NULL; | 1085 | v->load_addr = NULL; |
| 1086 | v->len = 0; | 1086 | v->len = 0; |
| 1087 | 1087 | ||
| 1088 | v->uid = filp->f_uid; | 1088 | v->uid = filp->f_cred->fsuid; |
| 1089 | v->gid = filp->f_gid; | 1089 | v->gid = filp->f_cred->fsgid; |
| 1090 | 1090 | ||
| 1091 | #ifdef CONFIG_MIPS_APSP_KSPD | 1091 | #ifdef CONFIG_MIPS_APSP_KSPD |
| 1092 | /* get kspd to tell us when a syscall_exit happens */ | 1092 | /* get kspd to tell us when a syscall_exit happens */ |
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 484299b031f8..8f9f4912de32 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c | |||
| @@ -246,7 +246,8 @@ hysdn_conf_open(struct inode *ino, struct file *filep) | |||
| 246 | } | 246 | } |
| 247 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) | 247 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) |
| 248 | hysdn_addlog(card, "config open for uid=%d gid=%d mode=0x%x", | 248 | hysdn_addlog(card, "config open for uid=%d gid=%d mode=0x%x", |
| 249 | filep->f_uid, filep->f_gid, filep->f_mode); | 249 | filep->f_cred->fsuid, filep->f_cred->fsgid, |
| 250 | filep->f_mode); | ||
| 250 | 251 | ||
| 251 | if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { | 252 | if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { |
| 252 | /* write only access -> write boot file or conf line */ | 253 | /* write only access -> write boot file or conf line */ |
| @@ -331,7 +332,8 @@ hysdn_conf_close(struct inode *ino, struct file *filep) | |||
| 331 | } | 332 | } |
| 332 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) | 333 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) |
| 333 | hysdn_addlog(card, "config close for uid=%d gid=%d mode=0x%x", | 334 | hysdn_addlog(card, "config close for uid=%d gid=%d mode=0x%x", |
| 334 | filep->f_uid, filep->f_gid, filep->f_mode); | 335 | filep->f_cred->fsuid, filep->f_cred->fsgid, |
| 336 | filep->f_mode); | ||
| 335 | 337 | ||
| 336 | if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { | 338 | if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { |
| 337 | /* write only access -> write boot file or conf line */ | 339 | /* write only access -> write boot file or conf line */ |
diff --git a/fs/coda/file.c b/fs/coda/file.c index 29137ff3ca67..5a8769985494 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c | |||
| @@ -174,7 +174,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file) | |||
| 174 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | 174 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); |
| 175 | 175 | ||
| 176 | err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode), | 176 | err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode), |
| 177 | coda_flags, coda_file->f_uid); | 177 | coda_flags, coda_file->f_cred->fsuid); |
| 178 | 178 | ||
| 179 | host_inode = cfi->cfi_container->f_path.dentry->d_inode; | 179 | host_inode = cfi->cfi_container->f_path.dentry->d_inode; |
| 180 | cii = ITOC(coda_inode); | 180 | cii = ITOC(coda_inode); |
diff --git a/fs/file_table.c b/fs/file_table.c index bc4563fe791d..0fbcacc3ea75 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
| @@ -36,7 +36,9 @@ static struct percpu_counter nr_files __cacheline_aligned_in_smp; | |||
| 36 | 36 | ||
| 37 | static inline void file_free_rcu(struct rcu_head *head) | 37 | static inline void file_free_rcu(struct rcu_head *head) |
| 38 | { | 38 | { |
| 39 | struct file *f = container_of(head, struct file, f_u.fu_rcuhead); | 39 | struct file *f = container_of(head, struct file, f_u.fu_rcuhead); |
| 40 | |||
| 41 | put_cred(f->f_cred); | ||
| 40 | kmem_cache_free(filp_cachep, f); | 42 | kmem_cache_free(filp_cachep, f); |
| 41 | } | 43 | } |
| 42 | 44 | ||
| @@ -121,8 +123,7 @@ struct file *get_empty_filp(void) | |||
| 121 | INIT_LIST_HEAD(&f->f_u.fu_list); | 123 | INIT_LIST_HEAD(&f->f_u.fu_list); |
| 122 | atomic_long_set(&f->f_count, 1); | 124 | atomic_long_set(&f->f_count, 1); |
| 123 | rwlock_init(&f->f_owner.lock); | 125 | rwlock_init(&f->f_owner.lock); |
| 124 | f->f_uid = cred->fsuid; | 126 | f->f_cred = get_cred(cred); |
| 125 | f->f_gid = cred->fsgid; | ||
| 126 | eventpoll_init_file(f); | 127 | eventpoll_init_file(f); |
| 127 | /* f->f_version: 0 */ | 128 | /* f->f_version: 0 */ |
| 128 | return f; | 129 | return f; |
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c index 795e2c130ad7..b278f7f52024 100644 --- a/fs/hppfs/hppfs.c +++ b/fs/hppfs/hppfs.c | |||
| @@ -426,7 +426,7 @@ static int file_mode(int fmode) | |||
| 426 | 426 | ||
| 427 | static int hppfs_open(struct inode *inode, struct file *file) | 427 | static int hppfs_open(struct inode *inode, struct file *file) |
| 428 | { | 428 | { |
| 429 | const struct cred *cred = current_cred(); | 429 | const struct cred *cred = file->f_cred; |
| 430 | struct hppfs_private *data; | 430 | struct hppfs_private *data; |
| 431 | struct vfsmount *proc_mnt; | 431 | struct vfsmount *proc_mnt; |
| 432 | struct dentry *proc_dentry; | 432 | struct dentry *proc_dentry; |
| @@ -490,7 +490,7 @@ static int hppfs_open(struct inode *inode, struct file *file) | |||
| 490 | 490 | ||
| 491 | static int hppfs_dir_open(struct inode *inode, struct file *file) | 491 | static int hppfs_dir_open(struct inode *inode, struct file *file) |
| 492 | { | 492 | { |
| 493 | const struct cred *cred = current_cred(); | 493 | const struct cred *cred = file->f_cred; |
| 494 | struct hppfs_private *data; | 494 | struct hppfs_private *data; |
| 495 | struct vfsmount *proc_mnt; | 495 | struct vfsmount *proc_mnt; |
| 496 | struct dentry *proc_dentry; | 496 | struct dentry *proc_dentry; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 3bfec1327b8d..c0fb6d81d89b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -827,7 +827,7 @@ struct file { | |||
| 827 | fmode_t f_mode; | 827 | fmode_t f_mode; |
| 828 | loff_t f_pos; | 828 | loff_t f_pos; |
| 829 | struct fown_struct f_owner; | 829 | struct fown_struct f_owner; |
| 830 | unsigned int f_uid, f_gid; | 830 | const struct cred *f_cred; |
| 831 | struct file_ra_state f_ra; | 831 | struct file_ra_state f_ra; |
| 832 | 832 | ||
| 833 | u64 f_version; | 833 | u64 f_version; |
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c index fc6ce04a3e35..7b5dbe118c09 100644 --- a/net/ipv4/netfilter/ipt_LOG.c +++ b/net/ipv4/netfilter/ipt_LOG.c | |||
| @@ -340,8 +340,8 @@ static void dump_packet(const struct nf_loginfo *info, | |||
| 340 | read_lock_bh(&skb->sk->sk_callback_lock); | 340 | read_lock_bh(&skb->sk->sk_callback_lock); |
| 341 | if (skb->sk->sk_socket && skb->sk->sk_socket->file) | 341 | if (skb->sk->sk_socket && skb->sk->sk_socket->file) |
| 342 | printk("UID=%u GID=%u ", | 342 | printk("UID=%u GID=%u ", |
| 343 | skb->sk->sk_socket->file->f_uid, | 343 | skb->sk->sk_socket->file->f_cred->fsuid, |
| 344 | skb->sk->sk_socket->file->f_gid); | 344 | skb->sk->sk_socket->file->f_cred->fsgid); |
| 345 | read_unlock_bh(&skb->sk->sk_callback_lock); | 345 | read_unlock_bh(&skb->sk->sk_callback_lock); |
| 346 | } | 346 | } |
| 347 | 347 | ||
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index caa441d09567..871d157cec4e 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c | |||
| @@ -364,8 +364,8 @@ static void dump_packet(const struct nf_loginfo *info, | |||
| 364 | read_lock_bh(&skb->sk->sk_callback_lock); | 364 | read_lock_bh(&skb->sk->sk_callback_lock); |
| 365 | if (skb->sk->sk_socket && skb->sk->sk_socket->file) | 365 | if (skb->sk->sk_socket && skb->sk->sk_socket->file) |
| 366 | printk("UID=%u GID=%u ", | 366 | printk("UID=%u GID=%u ", |
| 367 | skb->sk->sk_socket->file->f_uid, | 367 | skb->sk->sk_socket->file->f_cred->fsuid, |
| 368 | skb->sk->sk_socket->file->f_gid); | 368 | skb->sk->sk_socket->file->f_cred->fsgid); |
| 369 | read_unlock_bh(&skb->sk->sk_callback_lock); | 369 | read_unlock_bh(&skb->sk->sk_callback_lock); |
| 370 | } | 370 | } |
| 371 | 371 | ||
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 41e0105d3828..38f9efd90e8d 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
| @@ -474,8 +474,9 @@ __build_packet_message(struct nfulnl_instance *inst, | |||
| 474 | if (skb->sk) { | 474 | if (skb->sk) { |
| 475 | read_lock_bh(&skb->sk->sk_callback_lock); | 475 | read_lock_bh(&skb->sk->sk_callback_lock); |
| 476 | if (skb->sk->sk_socket && skb->sk->sk_socket->file) { | 476 | if (skb->sk->sk_socket && skb->sk->sk_socket->file) { |
| 477 | __be32 uid = htonl(skb->sk->sk_socket->file->f_uid); | 477 | struct file *file = skb->sk->sk_socket->file; |
| 478 | __be32 gid = htonl(skb->sk->sk_socket->file->f_gid); | 478 | __be32 uid = htonl(file->f_cred->fsuid); |
| 479 | __be32 gid = htonl(file->f_cred->fsgid); | ||
| 479 | /* need to unlock here since NLA_PUT may goto */ | 480 | /* need to unlock here since NLA_PUT may goto */ |
| 480 | read_unlock_bh(&skb->sk->sk_callback_lock); | 481 | read_unlock_bh(&skb->sk->sk_callback_lock); |
| 481 | NLA_PUT_BE32(inst->skb, NFULA_UID, uid); | 482 | NLA_PUT_BE32(inst->skb, NFULA_UID, uid); |
diff --git a/net/netfilter/xt_owner.c b/net/netfilter/xt_owner.c index f19ebd9b78f5..22b2a5e881ea 100644 --- a/net/netfilter/xt_owner.c +++ b/net/netfilter/xt_owner.c | |||
| @@ -34,12 +34,12 @@ owner_mt_v0(const struct sk_buff *skb, const struct xt_match_param *par) | |||
| 34 | return false; | 34 | return false; |
| 35 | 35 | ||
| 36 | if (info->match & IPT_OWNER_UID) | 36 | if (info->match & IPT_OWNER_UID) |
| 37 | if ((filp->f_uid != info->uid) ^ | 37 | if ((filp->f_cred->fsuid != info->uid) ^ |
| 38 | !!(info->invert & IPT_OWNER_UID)) | 38 | !!(info->invert & IPT_OWNER_UID)) |
| 39 | return false; | 39 | return false; |
| 40 | 40 | ||
| 41 | if (info->match & IPT_OWNER_GID) | 41 | if (info->match & IPT_OWNER_GID) |
| 42 | if ((filp->f_gid != info->gid) ^ | 42 | if ((filp->f_cred->fsgid != info->gid) ^ |
| 43 | !!(info->invert & IPT_OWNER_GID)) | 43 | !!(info->invert & IPT_OWNER_GID)) |
| 44 | return false; | 44 | return false; |
| 45 | 45 | ||
| @@ -60,12 +60,12 @@ owner_mt6_v0(const struct sk_buff *skb, const struct xt_match_param *par) | |||
| 60 | return false; | 60 | return false; |
| 61 | 61 | ||
| 62 | if (info->match & IP6T_OWNER_UID) | 62 | if (info->match & IP6T_OWNER_UID) |
| 63 | if ((filp->f_uid != info->uid) ^ | 63 | if ((filp->f_cred->fsuid != info->uid) ^ |
| 64 | !!(info->invert & IP6T_OWNER_UID)) | 64 | !!(info->invert & IP6T_OWNER_UID)) |
| 65 | return false; | 65 | return false; |
| 66 | 66 | ||
| 67 | if (info->match & IP6T_OWNER_GID) | 67 | if (info->match & IP6T_OWNER_GID) |
| 68 | if ((filp->f_gid != info->gid) ^ | 68 | if ((filp->f_cred->fsgid != info->gid) ^ |
| 69 | !!(info->invert & IP6T_OWNER_GID)) | 69 | !!(info->invert & IP6T_OWNER_GID)) |
| 70 | return false; | 70 | return false; |
| 71 | 71 | ||
| @@ -93,14 +93,14 @@ owner_mt(const struct sk_buff *skb, const struct xt_match_param *par) | |||
| 93 | (XT_OWNER_UID | XT_OWNER_GID)) == 0; | 93 | (XT_OWNER_UID | XT_OWNER_GID)) == 0; |
| 94 | 94 | ||
| 95 | if (info->match & XT_OWNER_UID) | 95 | if (info->match & XT_OWNER_UID) |
| 96 | if ((filp->f_uid >= info->uid_min && | 96 | if ((filp->f_cred->fsuid >= info->uid_min && |
| 97 | filp->f_uid <= info->uid_max) ^ | 97 | filp->f_cred->fsuid <= info->uid_max) ^ |
| 98 | !(info->invert & XT_OWNER_UID)) | 98 | !(info->invert & XT_OWNER_UID)) |
| 99 | return false; | 99 | return false; |
| 100 | 100 | ||
| 101 | if (info->match & XT_OWNER_GID) | 101 | if (info->match & XT_OWNER_GID) |
| 102 | if ((filp->f_gid >= info->gid_min && | 102 | if ((filp->f_cred->fsgid >= info->gid_min && |
| 103 | filp->f_gid <= info->gid_max) ^ | 103 | filp->f_cred->fsgid <= info->gid_max) ^ |
| 104 | !(info->invert & XT_OWNER_GID)) | 104 | !(info->invert & XT_OWNER_GID)) |
| 105 | return false; | 105 | return false; |
| 106 | 106 | ||
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index 0ebaff637e31..0ef4e3065bcd 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c | |||
| @@ -260,14 +260,14 @@ static u32 flow_get_rtclassid(const struct sk_buff *skb) | |||
| 260 | static u32 flow_get_skuid(const struct sk_buff *skb) | 260 | static u32 flow_get_skuid(const struct sk_buff *skb) |
| 261 | { | 261 | { |
| 262 | if (skb->sk && skb->sk->sk_socket && skb->sk->sk_socket->file) | 262 | if (skb->sk && skb->sk->sk_socket && skb->sk->sk_socket->file) |
| 263 | return skb->sk->sk_socket->file->f_uid; | 263 | return skb->sk->sk_socket->file->f_cred->fsuid; |
| 264 | return 0; | 264 | return 0; |
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | static u32 flow_get_skgid(const struct sk_buff *skb) | 267 | static u32 flow_get_skgid(const struct sk_buff *skb) |
| 268 | { | 268 | { |
| 269 | if (skb->sk && skb->sk->sk_socket && skb->sk->sk_socket->file) | 269 | if (skb->sk && skb->sk->sk_socket && skb->sk->sk_socket->file) |
| 270 | return skb->sk->sk_socket->file->f_gid; | 270 | return skb->sk->sk_socket->file->f_cred->fsgid; |
| 271 | return 0; | 271 | return 0; |
| 272 | } | 272 | } |
| 273 | 273 | ||
