aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/9p/client.c2
-rw-r--r--net/ax25/af_ax25.c2
-rw-r--r--net/ax25/ax25_route.c2
-rw-r--r--net/core/dev.c8
-rw-r--r--net/core/scm.c10
-rw-r--r--net/ipv4/netfilter/ipt_LOG.c4
-rw-r--r--net/ipv6/ip6_flowlabel.c2
-rw-r--r--net/ipv6/netfilter/ip6t_LOG.c4
-rw-r--r--net/iucv/af_iucv.c19
-rw-r--r--net/iucv/iucv.c161
-rw-r--r--net/netfilter/nfnetlink_log.c5
-rw-r--r--net/netfilter/xt_owner.c16
-rw-r--r--net/netrom/af_netrom.c4
-rw-r--r--net/rose/af_rose.c4
-rw-r--r--net/rxrpc/ar-key.c6
-rw-r--r--net/sched/cls_flow.c4
-rw-r--r--net/socket.c4
-rw-r--r--net/sunrpc/auth.c14
-rw-r--r--net/unix/af_unix.c11
19 files changed, 194 insertions, 88 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index 4b529454616d..821f1ec0b2c3 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -627,7 +627,7 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt)
627 memset(&fid->qid, 0, sizeof(struct p9_qid)); 627 memset(&fid->qid, 0, sizeof(struct p9_qid));
628 fid->mode = -1; 628 fid->mode = -1;
629 fid->rdir_fpos = 0; 629 fid->rdir_fpos = 0;
630 fid->uid = current->fsuid; 630 fid->uid = current_fsuid();
631 fid->clnt = clnt; 631 fid->clnt = clnt;
632 fid->aux = NULL; 632 fid->aux = NULL;
633 633
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 28c71574a781..00d9e5e13158 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1045,7 +1045,7 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
1045 if (addr->fsa_ax25.sax25_family != AF_AX25) 1045 if (addr->fsa_ax25.sax25_family != AF_AX25)
1046 return -EINVAL; 1046 return -EINVAL;
1047 1047
1048 user = ax25_findbyuid(current->euid); 1048 user = ax25_findbyuid(current_euid());
1049 if (user) { 1049 if (user) {
1050 call = user->call; 1050 call = user->call;
1051 ax25_uid_put(user); 1051 ax25_uid_put(user);
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
index 8672cd84fdf9..c833ba4c45a5 100644
--- a/net/ax25/ax25_route.c
+++ b/net/ax25/ax25_route.c
@@ -421,7 +421,7 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr)
421 goto put; 421 goto put;
422 } 422 }
423 423
424 user = ax25_findbyuid(current->euid); 424 user = ax25_findbyuid(current_euid());
425 if (user) { 425 if (user) {
426 ax25->source_addr = user->call; 426 ax25->source_addr = user->call;
427 ax25_uid_put(user); 427 ax25_uid_put(user);
diff --git a/net/core/dev.c b/net/core/dev.c
index 9174c77d3112..89912ae6de65 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2961,6 +2961,8 @@ static void dev_change_rx_flags(struct net_device *dev, int flags)
2961static int __dev_set_promiscuity(struct net_device *dev, int inc) 2961static int __dev_set_promiscuity(struct net_device *dev, int inc)
2962{ 2962{
2963 unsigned short old_flags = dev->flags; 2963 unsigned short old_flags = dev->flags;
2964 uid_t uid;
2965 gid_t gid;
2964 2966
2965 ASSERT_RTNL(); 2967 ASSERT_RTNL();
2966 2968
@@ -2985,15 +2987,17 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc)
2985 printk(KERN_INFO "device %s %s promiscuous mode\n", 2987 printk(KERN_INFO "device %s %s promiscuous mode\n",
2986 dev->name, (dev->flags & IFF_PROMISC) ? "entered" : 2988 dev->name, (dev->flags & IFF_PROMISC) ? "entered" :
2987 "left"); 2989 "left");
2988 if (audit_enabled) 2990 if (audit_enabled) {
2991 current_uid_gid(&uid, &gid);
2989 audit_log(current->audit_context, GFP_ATOMIC, 2992 audit_log(current->audit_context, GFP_ATOMIC,
2990 AUDIT_ANOM_PROMISCUOUS, 2993 AUDIT_ANOM_PROMISCUOUS,
2991 "dev=%s prom=%d old_prom=%d auid=%u uid=%u gid=%u ses=%u", 2994 "dev=%s prom=%d old_prom=%d auid=%u uid=%u gid=%u ses=%u",
2992 dev->name, (dev->flags & IFF_PROMISC), 2995 dev->name, (dev->flags & IFF_PROMISC),
2993 (old_flags & IFF_PROMISC), 2996 (old_flags & IFF_PROMISC),
2994 audit_get_loginuid(current), 2997 audit_get_loginuid(current),
2995 current->uid, current->gid, 2998 uid, gid,
2996 audit_get_sessionid(current)); 2999 audit_get_sessionid(current));
3000 }
2997 3001
2998 dev_change_rx_flags(dev, IFF_PROMISC); 3002 dev_change_rx_flags(dev, IFF_PROMISC);
2999 } 3003 }
diff --git a/net/core/scm.c b/net/core/scm.c
index b12303dd39d9..b7ba91b074b3 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -44,11 +44,13 @@
44 44
45static __inline__ int scm_check_creds(struct ucred *creds) 45static __inline__ int scm_check_creds(struct ucred *creds)
46{ 46{
47 const struct cred *cred = current_cred();
48
47 if ((creds->pid == task_tgid_vnr(current) || capable(CAP_SYS_ADMIN)) && 49 if ((creds->pid == task_tgid_vnr(current) || capable(CAP_SYS_ADMIN)) &&
48 ((creds->uid == current->uid || creds->uid == current->euid || 50 ((creds->uid == cred->uid || creds->uid == cred->euid ||
49 creds->uid == current->suid) || capable(CAP_SETUID)) && 51 creds->uid == cred->suid) || capable(CAP_SETUID)) &&
50 ((creds->gid == current->gid || creds->gid == current->egid || 52 ((creds->gid == cred->gid || creds->gid == cred->egid ||
51 creds->gid == current->sgid) || capable(CAP_SETGID))) { 53 creds->gid == cred->sgid) || capable(CAP_SETGID))) {
52 return 0; 54 return 0;
53 } 55 }
54 return -EPERM; 56 return -EPERM;
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/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 37a4e777e347..bd3c7b96bbaa 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -388,7 +388,7 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
388 fl->owner = current->pid; 388 fl->owner = current->pid;
389 break; 389 break;
390 case IPV6_FL_S_USER: 390 case IPV6_FL_S_USER:
391 fl->owner = current->euid; 391 fl->owner = current_euid();
392 break; 392 break;
393 default: 393 default:
394 err = -EINVAL; 394 err = -EINVAL;
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/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 29f7baa25110..af3192d2a5a3 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -8,6 +8,9 @@
8 * Author(s): Jennifer Hunt <jenhunt@us.ibm.com> 8 * Author(s): Jennifer Hunt <jenhunt@us.ibm.com>
9 */ 9 */
10 10
11#define KMSG_COMPONENT "af_iucv"
12#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
13
11#include <linux/module.h> 14#include <linux/module.h>
12#include <linux/types.h> 15#include <linux/types.h>
13#include <linux/list.h> 16#include <linux/list.h>
@@ -616,6 +619,8 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
616 struct iucv_sock *iucv = iucv_sk(sk); 619 struct iucv_sock *iucv = iucv_sk(sk);
617 struct sk_buff *skb; 620 struct sk_buff *skb;
618 struct iucv_message txmsg; 621 struct iucv_message txmsg;
622 char user_id[9];
623 char appl_id[9];
619 int err; 624 int err;
620 625
621 err = sock_error(sk); 626 err = sock_error(sk);
@@ -651,8 +656,15 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
651 err = iucv_message_send(iucv->path, &txmsg, 0, 0, 656 err = iucv_message_send(iucv->path, &txmsg, 0, 0,
652 (void *) skb->data, skb->len); 657 (void *) skb->data, skb->len);
653 if (err) { 658 if (err) {
654 if (err == 3) 659 if (err == 3) {
655 printk(KERN_ERR "AF_IUCV msg limit exceeded\n"); 660 user_id[8] = 0;
661 memcpy(user_id, iucv->dst_user_id, 8);
662 appl_id[8] = 0;
663 memcpy(appl_id, iucv->dst_name, 8);
664 pr_err("Application %s on z/VM guest %s"
665 " exceeds message limit\n",
666 user_id, appl_id);
667 }
656 skb_unlink(skb, &iucv->send_skb_q); 668 skb_unlink(skb, &iucv->send_skb_q);
657 err = -EPIPE; 669 err = -EPIPE;
658 goto fail; 670 goto fail;
@@ -1190,7 +1202,8 @@ static int __init afiucv_init(void)
1190 int err; 1202 int err;
1191 1203
1192 if (!MACHINE_IS_VM) { 1204 if (!MACHINE_IS_VM) {
1193 printk(KERN_ERR "AF_IUCV connection needs VM as base\n"); 1205 pr_err("The af_iucv module cannot be loaded"
1206 " without z/VM\n");
1194 err = -EPROTONOSUPPORT; 1207 err = -EPROTONOSUPPORT;
1195 goto out; 1208 goto out;
1196 } 1209 }
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index d7b54b5bfa69..8f57d4f4328a 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -30,6 +30,9 @@
30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 */ 31 */
32 32
33#define KMSG_COMPONENT "iucv"
34#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
35
33#include <linux/module.h> 36#include <linux/module.h>
34#include <linux/moduleparam.h> 37#include <linux/moduleparam.h>
35#include <linux/spinlock.h> 38#include <linux/spinlock.h>
@@ -424,8 +427,8 @@ static void iucv_declare_cpu(void *data)
424 err = "Paging or storage error"; 427 err = "Paging or storage error";
425 break; 428 break;
426 } 429 }
427 printk(KERN_WARNING "iucv_register: iucv_declare_buffer " 430 pr_warning("Defining an interrupt buffer on CPU %i"
428 "on cpu %i returned error 0x%02x (%s)\n", cpu, rc, err); 431 " failed with 0x%02x (%s)\n", cpu, rc, err);
429 return; 432 return;
430 } 433 }
431 434
@@ -957,7 +960,52 @@ int iucv_message_purge(struct iucv_path *path, struct iucv_message *msg,
957EXPORT_SYMBOL(iucv_message_purge); 960EXPORT_SYMBOL(iucv_message_purge);
958 961
959/** 962/**
960 * iucv_message_receive 963 * iucv_message_receive_iprmdata
964 * @path: address of iucv path structure
965 * @msg: address of iucv msg structure
966 * @flags: how the message is received (IUCV_IPBUFLST)
967 * @buffer: address of data buffer or address of struct iucv_array
968 * @size: length of data buffer
969 * @residual:
970 *
971 * Internal function used by iucv_message_receive and __iucv_message_receive
972 * to receive RMDATA data stored in struct iucv_message.
973 */
974static int iucv_message_receive_iprmdata(struct iucv_path *path,
975 struct iucv_message *msg,
976 u8 flags, void *buffer,
977 size_t size, size_t *residual)
978{
979 struct iucv_array *array;
980 u8 *rmmsg;
981 size_t copy;
982
983 /*
984 * Message is 8 bytes long and has been stored to the
985 * message descriptor itself.
986 */
987 if (residual)
988 *residual = abs(size - 8);
989 rmmsg = msg->rmmsg;
990 if (flags & IUCV_IPBUFLST) {
991 /* Copy to struct iucv_array. */
992 size = (size < 8) ? size : 8;
993 for (array = buffer; size > 0; array++) {
994 copy = min_t(size_t, size, array->length);
995 memcpy((u8 *)(addr_t) array->address,
996 rmmsg, copy);
997 rmmsg += copy;
998 size -= copy;
999 }
1000 } else {
1001 /* Copy to direct buffer. */
1002 memcpy(buffer, rmmsg, min_t(size_t, size, 8));
1003 }
1004 return 0;
1005}
1006
1007/**
1008 * __iucv_message_receive
961 * @path: address of iucv path structure 1009 * @path: address of iucv path structure
962 * @msg: address of iucv msg structure 1010 * @msg: address of iucv msg structure
963 * @flags: how the message is received (IUCV_IPBUFLST) 1011 * @flags: how the message is received (IUCV_IPBUFLST)
@@ -969,44 +1017,19 @@ EXPORT_SYMBOL(iucv_message_purge);
969 * established paths. This function will deal with RMDATA messages 1017 * established paths. This function will deal with RMDATA messages
970 * embedded in struct iucv_message as well. 1018 * embedded in struct iucv_message as well.
971 * 1019 *
1020 * Locking: no locking
1021 *
972 * Returns the result from the CP IUCV call. 1022 * Returns the result from the CP IUCV call.
973 */ 1023 */
974int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg, 1024int __iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
975 u8 flags, void *buffer, size_t size, size_t *residual) 1025 u8 flags, void *buffer, size_t size, size_t *residual)
976{ 1026{
977 union iucv_param *parm; 1027 union iucv_param *parm;
978 struct iucv_array *array;
979 u8 *rmmsg;
980 size_t copy;
981 int rc; 1028 int rc;
982 1029
983 if (msg->flags & IUCV_IPRMDATA) { 1030 if (msg->flags & IUCV_IPRMDATA)
984 /* 1031 return iucv_message_receive_iprmdata(path, msg, flags,
985 * Message is 8 bytes long and has been stored to the 1032 buffer, size, residual);
986 * message descriptor itself.
987 */
988 rc = (size < 8) ? 5 : 0;
989 if (residual)
990 *residual = abs(size - 8);
991 rmmsg = msg->rmmsg;
992 if (flags & IUCV_IPBUFLST) {
993 /* Copy to struct iucv_array. */
994 size = (size < 8) ? size : 8;
995 for (array = buffer; size > 0; array++) {
996 copy = min_t(size_t, size, array->length);
997 memcpy((u8 *)(addr_t) array->address,
998 rmmsg, copy);
999 rmmsg += copy;
1000 size -= copy;
1001 }
1002 } else {
1003 /* Copy to direct buffer. */
1004 memcpy(buffer, rmmsg, min_t(size_t, size, 8));
1005 }
1006 return 0;
1007 }
1008
1009 local_bh_disable();
1010 parm = iucv_param[smp_processor_id()]; 1033 parm = iucv_param[smp_processor_id()];
1011 memset(parm, 0, sizeof(union iucv_param)); 1034 memset(parm, 0, sizeof(union iucv_param));
1012 parm->db.ipbfadr1 = (u32)(addr_t) buffer; 1035 parm->db.ipbfadr1 = (u32)(addr_t) buffer;
@@ -1022,6 +1045,37 @@ int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
1022 if (residual) 1045 if (residual)
1023 *residual = parm->db.ipbfln1f; 1046 *residual = parm->db.ipbfln1f;
1024 } 1047 }
1048 return rc;
1049}
1050EXPORT_SYMBOL(__iucv_message_receive);
1051
1052/**
1053 * iucv_message_receive
1054 * @path: address of iucv path structure
1055 * @msg: address of iucv msg structure
1056 * @flags: how the message is received (IUCV_IPBUFLST)
1057 * @buffer: address of data buffer or address of struct iucv_array
1058 * @size: length of data buffer
1059 * @residual:
1060 *
1061 * This function receives messages that are being sent to you over
1062 * established paths. This function will deal with RMDATA messages
1063 * embedded in struct iucv_message as well.
1064 *
1065 * Locking: local_bh_enable/local_bh_disable
1066 *
1067 * Returns the result from the CP IUCV call.
1068 */
1069int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
1070 u8 flags, void *buffer, size_t size, size_t *residual)
1071{
1072 int rc;
1073
1074 if (msg->flags & IUCV_IPRMDATA)
1075 return iucv_message_receive_iprmdata(path, msg, flags,
1076 buffer, size, residual);
1077 local_bh_disable();
1078 rc = __iucv_message_receive(path, msg, flags, buffer, size, residual);
1025 local_bh_enable(); 1079 local_bh_enable();
1026 return rc; 1080 return rc;
1027} 1081}
@@ -1101,7 +1155,7 @@ int iucv_message_reply(struct iucv_path *path, struct iucv_message *msg,
1101EXPORT_SYMBOL(iucv_message_reply); 1155EXPORT_SYMBOL(iucv_message_reply);
1102 1156
1103/** 1157/**
1104 * iucv_message_send 1158 * __iucv_message_send
1105 * @path: address of iucv path structure 1159 * @path: address of iucv path structure
1106 * @msg: address of iucv msg structure 1160 * @msg: address of iucv msg structure
1107 * @flags: how the message is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST) 1161 * @flags: how the message is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
@@ -1113,15 +1167,16 @@ EXPORT_SYMBOL(iucv_message_reply);
1113 * transmitted is in a buffer and this is a one-way message and the 1167 * transmitted is in a buffer and this is a one-way message and the
1114 * receiver will not reply to the message. 1168 * receiver will not reply to the message.
1115 * 1169 *
1170 * Locking: no locking
1171 *
1116 * Returns the result from the CP IUCV call. 1172 * Returns the result from the CP IUCV call.
1117 */ 1173 */
1118int iucv_message_send(struct iucv_path *path, struct iucv_message *msg, 1174int __iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
1119 u8 flags, u32 srccls, void *buffer, size_t size) 1175 u8 flags, u32 srccls, void *buffer, size_t size)
1120{ 1176{
1121 union iucv_param *parm; 1177 union iucv_param *parm;
1122 int rc; 1178 int rc;
1123 1179
1124 local_bh_disable();
1125 parm = iucv_param[smp_processor_id()]; 1180 parm = iucv_param[smp_processor_id()];
1126 memset(parm, 0, sizeof(union iucv_param)); 1181 memset(parm, 0, sizeof(union iucv_param));
1127 if (flags & IUCV_IPRMDATA) { 1182 if (flags & IUCV_IPRMDATA) {
@@ -1144,6 +1199,34 @@ int iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
1144 rc = iucv_call_b2f0(IUCV_SEND, parm); 1199 rc = iucv_call_b2f0(IUCV_SEND, parm);
1145 if (!rc) 1200 if (!rc)
1146 msg->id = parm->db.ipmsgid; 1201 msg->id = parm->db.ipmsgid;
1202 return rc;
1203}
1204EXPORT_SYMBOL(__iucv_message_send);
1205
1206/**
1207 * iucv_message_send
1208 * @path: address of iucv path structure
1209 * @msg: address of iucv msg structure
1210 * @flags: how the message is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
1211 * @srccls: source class of message
1212 * @buffer: address of send buffer or address of struct iucv_array
1213 * @size: length of send buffer
1214 *
1215 * This function transmits data to another application. Data to be
1216 * transmitted is in a buffer and this is a one-way message and the
1217 * receiver will not reply to the message.
1218 *
1219 * Locking: local_bh_enable/local_bh_disable
1220 *
1221 * Returns the result from the CP IUCV call.
1222 */
1223int iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
1224 u8 flags, u32 srccls, void *buffer, size_t size)
1225{
1226 int rc;
1227
1228 local_bh_disable();
1229 rc = __iucv_message_send(path, msg, flags, srccls, buffer, size);
1147 local_bh_enable(); 1230 local_bh_enable();
1148 return rc; 1231 return rc;
1149} 1232}
@@ -1572,7 +1655,7 @@ static void iucv_external_interrupt(u16 code)
1572 BUG_ON(p->iptype < 0x01 || p->iptype > 0x09); 1655 BUG_ON(p->iptype < 0x01 || p->iptype > 0x09);
1573 work = kmalloc(sizeof(struct iucv_irq_list), GFP_ATOMIC); 1656 work = kmalloc(sizeof(struct iucv_irq_list), GFP_ATOMIC);
1574 if (!work) { 1657 if (!work) {
1575 printk(KERN_WARNING "iucv_external_interrupt: out of memory\n"); 1658 pr_warning("iucv_external_interrupt: out of memory\n");
1576 return; 1659 return;
1577 } 1660 }
1578 memcpy(&work->data, p, sizeof(work->data)); 1661 memcpy(&work->data, p, sizeof(work->data));
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/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 9f1ea4a27b35..e9c05b8f4f45 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -609,7 +609,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
609 } else { 609 } else {
610 source = &addr->fsa_ax25.sax25_call; 610 source = &addr->fsa_ax25.sax25_call;
611 611
612 user = ax25_findbyuid(current->euid); 612 user = ax25_findbyuid(current_euid());
613 if (user) { 613 if (user) {
614 nr->user_addr = user->call; 614 nr->user_addr = user->call;
615 ax25_uid_put(user); 615 ax25_uid_put(user);
@@ -683,7 +683,7 @@ static int nr_connect(struct socket *sock, struct sockaddr *uaddr,
683 } 683 }
684 source = (ax25_address *)dev->dev_addr; 684 source = (ax25_address *)dev->dev_addr;
685 685
686 user = ax25_findbyuid(current->euid); 686 user = ax25_findbyuid(current_euid());
687 if (user) { 687 if (user) {
688 nr->user_addr = user->call; 688 nr->user_addr = user->call;
689 ax25_uid_put(user); 689 ax25_uid_put(user);
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 0c1cc7612800..01392649b462 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -690,7 +690,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
690 690
691 source = &addr->srose_call; 691 source = &addr->srose_call;
692 692
693 user = ax25_findbyuid(current->euid); 693 user = ax25_findbyuid(current_euid());
694 if (user) { 694 if (user) {
695 rose->source_call = user->call; 695 rose->source_call = user->call;
696 ax25_uid_put(user); 696 ax25_uid_put(user);
@@ -791,7 +791,7 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le
791 goto out_release; 791 goto out_release;
792 } 792 }
793 793
794 user = ax25_findbyuid(current->euid); 794 user = ax25_findbyuid(current_euid());
795 if (!user) { 795 if (!user) {
796 err = -EINVAL; 796 err = -EINVAL;
797 goto out_release; 797 goto out_release;
diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c
index 9a8ff684da79..ad8c7a782da1 100644
--- a/net/rxrpc/ar-key.c
+++ b/net/rxrpc/ar-key.c
@@ -287,6 +287,7 @@ int rxrpc_get_server_data_key(struct rxrpc_connection *conn,
287 time_t expiry, 287 time_t expiry,
288 u32 kvno) 288 u32 kvno)
289{ 289{
290 const struct cred *cred = current_cred();
290 struct key *key; 291 struct key *key;
291 int ret; 292 int ret;
292 293
@@ -297,7 +298,7 @@ int rxrpc_get_server_data_key(struct rxrpc_connection *conn,
297 298
298 _enter(""); 299 _enter("");
299 300
300 key = key_alloc(&key_type_rxrpc, "x", 0, 0, current, 0, 301 key = key_alloc(&key_type_rxrpc, "x", 0, 0, cred, 0,
301 KEY_ALLOC_NOT_IN_QUOTA); 302 KEY_ALLOC_NOT_IN_QUOTA);
302 if (IS_ERR(key)) { 303 if (IS_ERR(key)) {
303 _leave(" = -ENOMEM [alloc %ld]", PTR_ERR(key)); 304 _leave(" = -ENOMEM [alloc %ld]", PTR_ERR(key));
@@ -340,10 +341,11 @@ EXPORT_SYMBOL(rxrpc_get_server_data_key);
340 */ 341 */
341struct key *rxrpc_get_null_key(const char *keyname) 342struct key *rxrpc_get_null_key(const char *keyname)
342{ 343{
344 const struct cred *cred = current_cred();
343 struct key *key; 345 struct key *key;
344 int ret; 346 int ret;
345 347
346 key = key_alloc(&key_type_rxrpc, keyname, 0, 0, current, 348 key = key_alloc(&key_type_rxrpc, keyname, 0, 0, cred,
347 KEY_POS_SEARCH, KEY_ALLOC_NOT_IN_QUOTA); 349 KEY_POS_SEARCH, KEY_ALLOC_NOT_IN_QUOTA);
348 if (IS_ERR(key)) 350 if (IS_ERR(key))
349 return key; 351 return key;
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)
260static u32 flow_get_skuid(const struct sk_buff *skb) 260static 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
267static u32 flow_get_skgid(const struct sk_buff *skb) 267static 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
diff --git a/net/socket.c b/net/socket.c
index 76ba80aeac1a..072e2e525ae6 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -491,8 +491,8 @@ static struct socket *sock_alloc(void)
491 sock = SOCKET_I(inode); 491 sock = SOCKET_I(inode);
492 492
493 inode->i_mode = S_IFSOCK | S_IRWXUGO; 493 inode->i_mode = S_IFSOCK | S_IRWXUGO;
494 inode->i_uid = current->fsuid; 494 inode->i_uid = current_fsuid();
495 inode->i_gid = current->fsgid; 495 inode->i_gid = current_fsgid();
496 496
497 get_cpu_var(sockets_in_use)++; 497 get_cpu_var(sockets_in_use)++;
498 put_cpu_var(sockets_in_use); 498 put_cpu_var(sockets_in_use);
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index cb216b2df666..0443f8349458 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -350,16 +350,18 @@ EXPORT_SYMBOL_GPL(rpcauth_lookup_credcache);
350struct rpc_cred * 350struct rpc_cred *
351rpcauth_lookupcred(struct rpc_auth *auth, int flags) 351rpcauth_lookupcred(struct rpc_auth *auth, int flags)
352{ 352{
353 struct auth_cred acred = { 353 struct auth_cred acred;
354 .uid = current->fsuid,
355 .gid = current->fsgid,
356 .group_info = current->group_info,
357 };
358 struct rpc_cred *ret; 354 struct rpc_cred *ret;
355 const struct cred *cred = current_cred();
359 356
360 dprintk("RPC: looking up %s cred\n", 357 dprintk("RPC: looking up %s cred\n",
361 auth->au_ops->au_name); 358 auth->au_ops->au_name);
362 get_group_info(acred.group_info); 359
360 memset(&acred, 0, sizeof(acred));
361 acred.uid = cred->fsuid;
362 acred.gid = cred->fsgid;
363 acred.group_info = get_group_info(((struct cred *)cred)->group_info);
364
363 ret = auth->au_ops->lookup_cred(auth, &acred, flags); 365 ret = auth->au_ops->lookup_cred(auth, &acred, flags);
364 put_group_info(acred.group_info); 366 put_group_info(acred.group_info);
365 return ret; 367 return ret;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 66d5ac4773ab..b152e2b9b988 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -467,8 +467,7 @@ static int unix_listen(struct socket *sock, int backlog)
467 sk->sk_state = TCP_LISTEN; 467 sk->sk_state = TCP_LISTEN;
468 /* set credentials so connect can copy them */ 468 /* set credentials so connect can copy them */
469 sk->sk_peercred.pid = task_tgid_vnr(current); 469 sk->sk_peercred.pid = task_tgid_vnr(current);
470 sk->sk_peercred.uid = current->euid; 470 current_euid_egid(&sk->sk_peercred.uid, &sk->sk_peercred.gid);
471 sk->sk_peercred.gid = current->egid;
472 err = 0; 471 err = 0;
473 472
474out_unlock: 473out_unlock:
@@ -1126,8 +1125,7 @@ restart:
1126 newsk->sk_state = TCP_ESTABLISHED; 1125 newsk->sk_state = TCP_ESTABLISHED;
1127 newsk->sk_type = sk->sk_type; 1126 newsk->sk_type = sk->sk_type;
1128 newsk->sk_peercred.pid = task_tgid_vnr(current); 1127 newsk->sk_peercred.pid = task_tgid_vnr(current);
1129 newsk->sk_peercred.uid = current->euid; 1128 current_euid_egid(&newsk->sk_peercred.uid, &newsk->sk_peercred.gid);
1130 newsk->sk_peercred.gid = current->egid;
1131 newu = unix_sk(newsk); 1129 newu = unix_sk(newsk);
1132 newsk->sk_sleep = &newu->peer_wait; 1130 newsk->sk_sleep = &newu->peer_wait;
1133 otheru = unix_sk(other); 1131 otheru = unix_sk(other);
@@ -1187,8 +1185,9 @@ static int unix_socketpair(struct socket *socka, struct socket *sockb)
1187 unix_peer(ska)=skb; 1185 unix_peer(ska)=skb;
1188 unix_peer(skb)=ska; 1186 unix_peer(skb)=ska;
1189 ska->sk_peercred.pid = skb->sk_peercred.pid = task_tgid_vnr(current); 1187 ska->sk_peercred.pid = skb->sk_peercred.pid = task_tgid_vnr(current);
1190 ska->sk_peercred.uid = skb->sk_peercred.uid = current->euid; 1188 current_euid_egid(&skb->sk_peercred.uid, &skb->sk_peercred.gid);
1191 ska->sk_peercred.gid = skb->sk_peercred.gid = current->egid; 1189 ska->sk_peercred.uid = skb->sk_peercred.uid;
1190 ska->sk_peercred.gid = skb->sk_peercred.gid;
1192 1191
1193 if (ska->sk_type != SOCK_DGRAM) { 1192 if (ska->sk_type != SOCK_DGRAM) {
1194 ska->sk_state = TCP_ESTABLISHED; 1193 ska->sk_state = TCP_ESTABLISHED;