Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 120710
b: refs/heads/master
c: 8192b0c
h: refs/heads/master
v: v3
  • Loading branch information
David Howells authored and James Morris committed Nov 13, 2008
1 parent 500f5c4 commit 13f1a0b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 19d65624d38d6296dddf725d1b03baa8a491a553
refs/heads/master: 8192b0c482d7078fcdcb4854341b977426f6f09b
4 changes: 2 additions & 2 deletions trunk/include/net/scm.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
struct scm_cookie *scm)
{
struct task_struct *p = current;
scm->creds.uid = p->uid;
scm->creds.gid = p->gid;
scm->creds.uid = current_uid();
scm->creds.gid = current_gid();
scm->creds.pid = task_tgid_vnr(p);
scm->fp = NULL;
scm->seq = 0;
Expand Down
8 changes: 6 additions & 2 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2958,6 +2958,8 @@ static void dev_change_rx_flags(struct net_device *dev, int flags)
static int __dev_set_promiscuity(struct net_device *dev, int inc)
{
unsigned short old_flags = dev->flags;
uid_t uid;
gid_t gid;

ASSERT_RTNL();

Expand All @@ -2982,15 +2984,17 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc)
printk(KERN_INFO "device %s %s promiscuous mode\n",
dev->name, (dev->flags & IFF_PROMISC) ? "entered" :
"left");
if (audit_enabled)
if (audit_enabled) {
current_uid_gid(&uid, &gid);
audit_log(current->audit_context, GFP_ATOMIC,
AUDIT_ANOM_PROMISCUOUS,
"dev=%s prom=%d old_prom=%d auid=%u uid=%u gid=%u ses=%u",
dev->name, (dev->flags & IFF_PROMISC),
(old_flags & IFF_PROMISC),
audit_get_loginuid(current),
current->uid, current->gid,
uid, gid,
audit_get_sessionid(current));
}

dev_change_rx_flags(dev, IFF_PROMISC);
}
Expand Down
8 changes: 4 additions & 4 deletions trunk/net/core/scm.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
static __inline__ int scm_check_creds(struct ucred *creds)
{
if ((creds->pid == task_tgid_vnr(current) || capable(CAP_SYS_ADMIN)) &&
((creds->uid == current->uid || creds->uid == current->euid ||
creds->uid == current->suid) || capable(CAP_SETUID)) &&
((creds->gid == current->gid || creds->gid == current->egid ||
creds->gid == current->sgid) || capable(CAP_SETGID))) {
((creds->uid == current_uid() || creds->uid == current_euid() ||
creds->uid == current_suid()) || capable(CAP_SETUID)) &&
((creds->gid == current_gid() || creds->gid == current_egid() ||
creds->gid == current_sgid()) || capable(CAP_SETGID))) {
return 0;
}
return -EPERM;
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ static struct socket *sock_alloc(void)
sock = SOCKET_I(inode);

inode->i_mode = S_IFSOCK | S_IRWXUGO;
inode->i_uid = current->fsuid;
inode->i_gid = current->fsgid;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();

get_cpu_var(sockets_in_use)++;
put_cpu_var(sockets_in_use);
Expand Down

0 comments on commit 13f1a0b

Please sign in to comment.