diff options
Diffstat (limited to 'net')
45 files changed, 409 insertions, 254 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/atm/svc.c b/net/atm/svc.c index de1e4f2f3a43..8fb54dc870b3 100644 --- a/net/atm/svc.c +++ b/net/atm/svc.c | |||
@@ -293,7 +293,10 @@ static int svc_listen(struct socket *sock,int backlog) | |||
293 | error = -EINVAL; | 293 | error = -EINVAL; |
294 | goto out; | 294 | goto out; |
295 | } | 295 | } |
296 | vcc_insert_socket(sk); | 296 | if (test_bit(ATM_VF_LISTEN, &vcc->flags)) { |
297 | error = -EADDRINUSE; | ||
298 | goto out; | ||
299 | } | ||
297 | set_bit(ATM_VF_WAITING, &vcc->flags); | 300 | set_bit(ATM_VF_WAITING, &vcc->flags); |
298 | prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); | 301 | prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); |
299 | sigd_enq(vcc,as_listen,NULL,NULL,&vcc->local); | 302 | sigd_enq(vcc,as_listen,NULL,NULL,&vcc->local); |
@@ -307,6 +310,7 @@ static int svc_listen(struct socket *sock,int backlog) | |||
307 | goto out; | 310 | goto out; |
308 | } | 311 | } |
309 | set_bit(ATM_VF_LISTEN,&vcc->flags); | 312 | set_bit(ATM_VF_LISTEN,&vcc->flags); |
313 | vcc_insert_socket(sk); | ||
310 | sk->sk_max_ack_backlog = backlog > 0 ? backlog : ATM_BACKLOG_DEFAULT; | 314 | sk->sk_max_ack_backlog = backlog > 0 ? backlog : ATM_BACKLOG_DEFAULT; |
311 | error = -sk->sk_err; | 315 | error = -sk->sk_err; |
312 | out: | 316 | out: |
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/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index ba537fae0a4c..ce68e046d963 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -1786,8 +1786,6 @@ static inline void rfcomm_accept_connection(struct rfcomm_session *s) | |||
1786 | if (err < 0) | 1786 | if (err < 0) |
1787 | return; | 1787 | return; |
1788 | 1788 | ||
1789 | __module_get(nsock->ops->owner); | ||
1790 | |||
1791 | /* Set our callbacks */ | 1789 | /* Set our callbacks */ |
1792 | nsock->sk->sk_data_ready = rfcomm_l2data_ready; | 1790 | nsock->sk->sk_data_ready = rfcomm_l2data_ready; |
1793 | nsock->sk->sk_state_change = rfcomm_l2state_change; | 1791 | nsock->sk->sk_state_change = rfcomm_l2state_change; |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index fa5cda4e552a..45f61c348e36 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -101,6 +101,18 @@ static inline __be16 pppoe_proto(const struct sk_buff *skb) | |||
101 | pppoe_proto(skb) == htons(PPP_IPV6) && \ | 101 | pppoe_proto(skb) == htons(PPP_IPV6) && \ |
102 | brnf_filter_pppoe_tagged) | 102 | brnf_filter_pppoe_tagged) |
103 | 103 | ||
104 | static void fake_update_pmtu(struct dst_entry *dst, u32 mtu) | ||
105 | { | ||
106 | } | ||
107 | |||
108 | static struct dst_ops fake_dst_ops = { | ||
109 | .family = AF_INET, | ||
110 | .protocol = __constant_htons(ETH_P_IP), | ||
111 | .update_pmtu = fake_update_pmtu, | ||
112 | .entry_size = sizeof(struct rtable), | ||
113 | .entries = ATOMIC_INIT(0), | ||
114 | }; | ||
115 | |||
104 | /* | 116 | /* |
105 | * Initialize bogus route table used to keep netfilter happy. | 117 | * Initialize bogus route table used to keep netfilter happy. |
106 | * Currently, we fill in the PMTU entry because netfilter | 118 | * Currently, we fill in the PMTU entry because netfilter |
@@ -117,6 +129,7 @@ void br_netfilter_rtable_init(struct net_bridge *br) | |||
117 | rt->u.dst.path = &rt->u.dst; | 129 | rt->u.dst.path = &rt->u.dst; |
118 | rt->u.dst.metrics[RTAX_MTU - 1] = 1500; | 130 | rt->u.dst.metrics[RTAX_MTU - 1] = 1500; |
119 | rt->u.dst.flags = DST_NOXFRM; | 131 | rt->u.dst.flags = DST_NOXFRM; |
132 | rt->u.dst.ops = &fake_dst_ops; | ||
120 | } | 133 | } |
121 | 134 | ||
122 | static inline struct rtable *bridge_parent_rtable(const struct net_device *dev) | 135 | static inline struct rtable *bridge_parent_rtable(const struct net_device *dev) |
diff --git a/net/can/af_can.c b/net/can/af_can.c index 7d4d2b3c137e..3dadb338addd 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -319,23 +319,52 @@ static struct dev_rcv_lists *find_dev_rcv_lists(struct net_device *dev) | |||
319 | return n ? d : NULL; | 319 | return n ? d : NULL; |
320 | } | 320 | } |
321 | 321 | ||
322 | /** | ||
323 | * find_rcv_list - determine optimal filterlist inside device filter struct | ||
324 | * @can_id: pointer to CAN identifier of a given can_filter | ||
325 | * @mask: pointer to CAN mask of a given can_filter | ||
326 | * @d: pointer to the device filter struct | ||
327 | * | ||
328 | * Description: | ||
329 | * Returns the optimal filterlist to reduce the filter handling in the | ||
330 | * receive path. This function is called by service functions that need | ||
331 | * to register or unregister a can_filter in the filter lists. | ||
332 | * | ||
333 | * A filter matches in general, when | ||
334 | * | ||
335 | * <received_can_id> & mask == can_id & mask | ||
336 | * | ||
337 | * so every bit set in the mask (even CAN_EFF_FLAG, CAN_RTR_FLAG) describe | ||
338 | * relevant bits for the filter. | ||
339 | * | ||
340 | * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can | ||
341 | * filter for error frames (CAN_ERR_FLAG bit set in mask). For error frames | ||
342 | * there is a special filterlist and a special rx path filter handling. | ||
343 | * | ||
344 | * Return: | ||
345 | * Pointer to optimal filterlist for the given can_id/mask pair. | ||
346 | * Constistency checked mask. | ||
347 | * Reduced can_id to have a preprocessed filter compare value. | ||
348 | */ | ||
322 | static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask, | 349 | static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask, |
323 | struct dev_rcv_lists *d) | 350 | struct dev_rcv_lists *d) |
324 | { | 351 | { |
325 | canid_t inv = *can_id & CAN_INV_FILTER; /* save flag before masking */ | 352 | canid_t inv = *can_id & CAN_INV_FILTER; /* save flag before masking */ |
326 | 353 | ||
327 | /* filter error frames */ | 354 | /* filter for error frames in extra filterlist */ |
328 | if (*mask & CAN_ERR_FLAG) { | 355 | if (*mask & CAN_ERR_FLAG) { |
329 | /* clear CAN_ERR_FLAG in list entry */ | 356 | /* clear CAN_ERR_FLAG in filter entry */ |
330 | *mask &= CAN_ERR_MASK; | 357 | *mask &= CAN_ERR_MASK; |
331 | return &d->rx[RX_ERR]; | 358 | return &d->rx[RX_ERR]; |
332 | } | 359 | } |
333 | 360 | ||
334 | /* ensure valid values in can_mask */ | 361 | /* with cleared CAN_ERR_FLAG we have a simple mask/value filterpair */ |
335 | if (*mask & CAN_EFF_FLAG) | 362 | |
336 | *mask &= (CAN_EFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG); | 363 | #define CAN_EFF_RTR_FLAGS (CAN_EFF_FLAG | CAN_RTR_FLAG) |
337 | else | 364 | |
338 | *mask &= (CAN_SFF_MASK | CAN_RTR_FLAG); | 365 | /* ensure valid values in can_mask for 'SFF only' frame filtering */ |
366 | if ((*mask & CAN_EFF_FLAG) && !(*can_id & CAN_EFF_FLAG)) | ||
367 | *mask &= (CAN_SFF_MASK | CAN_EFF_RTR_FLAGS); | ||
339 | 368 | ||
340 | /* reduce condition testing at receive time */ | 369 | /* reduce condition testing at receive time */ |
341 | *can_id &= *mask; | 370 | *can_id &= *mask; |
@@ -348,15 +377,19 @@ static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask, | |||
348 | if (!(*mask)) | 377 | if (!(*mask)) |
349 | return &d->rx[RX_ALL]; | 378 | return &d->rx[RX_ALL]; |
350 | 379 | ||
351 | /* use extra filterset for the subscription of exactly *ONE* can_id */ | 380 | /* extra filterlists for the subscription of a single non-RTR can_id */ |
352 | if (*can_id & CAN_EFF_FLAG) { | 381 | if (((*mask & CAN_EFF_RTR_FLAGS) == CAN_EFF_RTR_FLAGS) |
353 | if (*mask == (CAN_EFF_MASK | CAN_EFF_FLAG)) { | 382 | && !(*can_id & CAN_RTR_FLAG)) { |
354 | /* RFC: a use-case for hash-tables in the future? */ | 383 | |
355 | return &d->rx[RX_EFF]; | 384 | if (*can_id & CAN_EFF_FLAG) { |
385 | if (*mask == (CAN_EFF_MASK | CAN_EFF_RTR_FLAGS)) { | ||
386 | /* RFC: a future use-case for hash-tables? */ | ||
387 | return &d->rx[RX_EFF]; | ||
388 | } | ||
389 | } else { | ||
390 | if (*mask == (CAN_SFF_MASK | CAN_EFF_RTR_FLAGS)) | ||
391 | return &d->rx_sff[*can_id]; | ||
356 | } | 392 | } |
357 | } else { | ||
358 | if (*mask == CAN_SFF_MASK) | ||
359 | return &d->rx_sff[*can_id]; | ||
360 | } | 393 | } |
361 | 394 | ||
362 | /* default: filter via can_id/can_mask */ | 395 | /* default: filter via can_id/can_mask */ |
@@ -589,7 +622,10 @@ static int can_rcv_filter(struct dev_rcv_lists *d, struct sk_buff *skb) | |||
589 | } | 622 | } |
590 | } | 623 | } |
591 | 624 | ||
592 | /* check CAN_ID specific entries */ | 625 | /* check filterlists for single non-RTR can_ids */ |
626 | if (can_id & CAN_RTR_FLAG) | ||
627 | return matches; | ||
628 | |||
593 | if (can_id & CAN_EFF_FLAG) { | 629 | if (can_id & CAN_EFF_FLAG) { |
594 | hlist_for_each_entry_rcu(r, n, &d->rx[RX_EFF], list) { | 630 | hlist_for_each_entry_rcu(r, n, &d->rx[RX_EFF], list) { |
595 | if (r->can_id == can_id) { | 631 | if (r->can_id == can_id) { |
diff --git a/net/can/bcm.c b/net/can/bcm.c index d0dd382001e2..da0d426c0ce4 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -64,10 +64,11 @@ | |||
64 | #define BCM_CAN_DLC_MASK 0x0F /* clean private flags in can_dlc by masking */ | 64 | #define BCM_CAN_DLC_MASK 0x0F /* clean private flags in can_dlc by masking */ |
65 | 65 | ||
66 | /* get best masking value for can_rx_register() for a given single can_id */ | 66 | /* get best masking value for can_rx_register() for a given single can_id */ |
67 | #define REGMASK(id) ((id & CAN_RTR_FLAG) | ((id & CAN_EFF_FLAG) ? \ | 67 | #define REGMASK(id) ((id & CAN_EFF_FLAG) ? \ |
68 | (CAN_EFF_MASK | CAN_EFF_FLAG) : CAN_SFF_MASK)) | 68 | (CAN_EFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG) : \ |
69 | (CAN_SFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG)) | ||
69 | 70 | ||
70 | #define CAN_BCM_VERSION "20080415" | 71 | #define CAN_BCM_VERSION CAN_VERSION |
71 | static __initdata const char banner[] = KERN_INFO | 72 | static __initdata const char banner[] = KERN_INFO |
72 | "can: broadcast manager protocol (rev " CAN_BCM_VERSION ")\n"; | 73 | "can: broadcast manager protocol (rev " CAN_BCM_VERSION ")\n"; |
73 | 74 | ||
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) | |||
2961 | static int __dev_set_promiscuity(struct net_device *dev, int inc) | 2961 | static 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/netpoll.c b/net/core/netpoll.c index 6c7af390be0a..dadac6281f20 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -133,9 +133,11 @@ static int poll_one_napi(struct netpoll_info *npinfo, | |||
133 | 133 | ||
134 | npinfo->rx_flags |= NETPOLL_RX_DROP; | 134 | npinfo->rx_flags |= NETPOLL_RX_DROP; |
135 | atomic_inc(&trapped); | 135 | atomic_inc(&trapped); |
136 | set_bit(NAPI_STATE_NPSVC, &napi->state); | ||
136 | 137 | ||
137 | work = napi->poll(napi, budget); | 138 | work = napi->poll(napi, budget); |
138 | 139 | ||
140 | clear_bit(NAPI_STATE_NPSVC, &napi->state); | ||
139 | atomic_dec(&trapped); | 141 | atomic_dec(&trapped); |
140 | npinfo->rx_flags &= ~NETPOLL_RX_DROP; | 142 | npinfo->rx_flags &= ~NETPOLL_RX_DROP; |
141 | 143 | ||
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 | ||
45 | static __inline__ int scm_check_creds(struct ucred *creds) | 45 | static __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/core/skbuff.c b/net/core/skbuff.c index d49ef8301b5b..65f7757465bd 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -149,7 +149,7 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here) | |||
149 | 149 | ||
150 | void skb_truesize_bug(struct sk_buff *skb) | 150 | void skb_truesize_bug(struct sk_buff *skb) |
151 | { | 151 | { |
152 | printk(KERN_ERR "SKB BUG: Invalid truesize (%u) " | 152 | WARN(net_ratelimit(), KERN_ERR "SKB BUG: Invalid truesize (%u) " |
153 | "len=%u, sizeof(sk_buff)=%Zd\n", | 153 | "len=%u, sizeof(sk_buff)=%Zd\n", |
154 | skb->truesize, skb->len, sizeof(struct sk_buff)); | 154 | skb->truesize, skb->len, sizeof(struct sk_buff)); |
155 | } | 155 | } |
diff --git a/net/core/sock.c b/net/core/sock.c index 341e39456952..edf7220889a4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -2035,9 +2035,6 @@ static inline void release_proto_idx(struct proto *prot) | |||
2035 | 2035 | ||
2036 | int proto_register(struct proto *prot, int alloc_slab) | 2036 | int proto_register(struct proto *prot, int alloc_slab) |
2037 | { | 2037 | { |
2038 | char *request_sock_slab_name = NULL; | ||
2039 | char *timewait_sock_slab_name; | ||
2040 | |||
2041 | if (alloc_slab) { | 2038 | if (alloc_slab) { |
2042 | prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, | 2039 | prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, |
2043 | SLAB_HWCACHE_ALIGN, NULL); | 2040 | SLAB_HWCACHE_ALIGN, NULL); |
@@ -2051,12 +2048,12 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
2051 | if (prot->rsk_prot != NULL) { | 2048 | if (prot->rsk_prot != NULL) { |
2052 | static const char mask[] = "request_sock_%s"; | 2049 | static const char mask[] = "request_sock_%s"; |
2053 | 2050 | ||
2054 | request_sock_slab_name = kmalloc(strlen(prot->name) + sizeof(mask) - 1, GFP_KERNEL); | 2051 | prot->rsk_prot->slab_name = kmalloc(strlen(prot->name) + sizeof(mask) - 1, GFP_KERNEL); |
2055 | if (request_sock_slab_name == NULL) | 2052 | if (prot->rsk_prot->slab_name == NULL) |
2056 | goto out_free_sock_slab; | 2053 | goto out_free_sock_slab; |
2057 | 2054 | ||
2058 | sprintf(request_sock_slab_name, mask, prot->name); | 2055 | sprintf(prot->rsk_prot->slab_name, mask, prot->name); |
2059 | prot->rsk_prot->slab = kmem_cache_create(request_sock_slab_name, | 2056 | prot->rsk_prot->slab = kmem_cache_create(prot->rsk_prot->slab_name, |
2060 | prot->rsk_prot->obj_size, 0, | 2057 | prot->rsk_prot->obj_size, 0, |
2061 | SLAB_HWCACHE_ALIGN, NULL); | 2058 | SLAB_HWCACHE_ALIGN, NULL); |
2062 | 2059 | ||
@@ -2070,14 +2067,14 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
2070 | if (prot->twsk_prot != NULL) { | 2067 | if (prot->twsk_prot != NULL) { |
2071 | static const char mask[] = "tw_sock_%s"; | 2068 | static const char mask[] = "tw_sock_%s"; |
2072 | 2069 | ||
2073 | timewait_sock_slab_name = kmalloc(strlen(prot->name) + sizeof(mask) - 1, GFP_KERNEL); | 2070 | prot->twsk_prot->twsk_slab_name = kmalloc(strlen(prot->name) + sizeof(mask) - 1, GFP_KERNEL); |
2074 | 2071 | ||
2075 | if (timewait_sock_slab_name == NULL) | 2072 | if (prot->twsk_prot->twsk_slab_name == NULL) |
2076 | goto out_free_request_sock_slab; | 2073 | goto out_free_request_sock_slab; |
2077 | 2074 | ||
2078 | sprintf(timewait_sock_slab_name, mask, prot->name); | 2075 | sprintf(prot->twsk_prot->twsk_slab_name, mask, prot->name); |
2079 | prot->twsk_prot->twsk_slab = | 2076 | prot->twsk_prot->twsk_slab = |
2080 | kmem_cache_create(timewait_sock_slab_name, | 2077 | kmem_cache_create(prot->twsk_prot->twsk_slab_name, |
2081 | prot->twsk_prot->twsk_obj_size, | 2078 | prot->twsk_prot->twsk_obj_size, |
2082 | 0, SLAB_HWCACHE_ALIGN, | 2079 | 0, SLAB_HWCACHE_ALIGN, |
2083 | NULL); | 2080 | NULL); |
@@ -2093,14 +2090,14 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
2093 | return 0; | 2090 | return 0; |
2094 | 2091 | ||
2095 | out_free_timewait_sock_slab_name: | 2092 | out_free_timewait_sock_slab_name: |
2096 | kfree(timewait_sock_slab_name); | 2093 | kfree(prot->twsk_prot->twsk_slab_name); |
2097 | out_free_request_sock_slab: | 2094 | out_free_request_sock_slab: |
2098 | if (prot->rsk_prot && prot->rsk_prot->slab) { | 2095 | if (prot->rsk_prot && prot->rsk_prot->slab) { |
2099 | kmem_cache_destroy(prot->rsk_prot->slab); | 2096 | kmem_cache_destroy(prot->rsk_prot->slab); |
2100 | prot->rsk_prot->slab = NULL; | 2097 | prot->rsk_prot->slab = NULL; |
2101 | } | 2098 | } |
2102 | out_free_request_sock_slab_name: | 2099 | out_free_request_sock_slab_name: |
2103 | kfree(request_sock_slab_name); | 2100 | kfree(prot->rsk_prot->slab_name); |
2104 | out_free_sock_slab: | 2101 | out_free_sock_slab: |
2105 | kmem_cache_destroy(prot->slab); | 2102 | kmem_cache_destroy(prot->slab); |
2106 | prot->slab = NULL; | 2103 | prot->slab = NULL; |
@@ -2123,18 +2120,14 @@ void proto_unregister(struct proto *prot) | |||
2123 | } | 2120 | } |
2124 | 2121 | ||
2125 | if (prot->rsk_prot != NULL && prot->rsk_prot->slab != NULL) { | 2122 | if (prot->rsk_prot != NULL && prot->rsk_prot->slab != NULL) { |
2126 | const char *name = kmem_cache_name(prot->rsk_prot->slab); | ||
2127 | |||
2128 | kmem_cache_destroy(prot->rsk_prot->slab); | 2123 | kmem_cache_destroy(prot->rsk_prot->slab); |
2129 | kfree(name); | 2124 | kfree(prot->rsk_prot->slab_name); |
2130 | prot->rsk_prot->slab = NULL; | 2125 | prot->rsk_prot->slab = NULL; |
2131 | } | 2126 | } |
2132 | 2127 | ||
2133 | if (prot->twsk_prot != NULL && prot->twsk_prot->twsk_slab != NULL) { | 2128 | if (prot->twsk_prot != NULL && prot->twsk_prot->twsk_slab != NULL) { |
2134 | const char *name = kmem_cache_name(prot->twsk_prot->twsk_slab); | ||
2135 | |||
2136 | kmem_cache_destroy(prot->twsk_prot->twsk_slab); | 2129 | kmem_cache_destroy(prot->twsk_prot->twsk_slab); |
2137 | kfree(name); | 2130 | kfree(prot->twsk_prot->twsk_slab_name); |
2138 | prot->twsk_prot->twsk_slab = NULL; | 2131 | prot->twsk_prot->twsk_slab = NULL; |
2139 | } | 2132 | } |
2140 | } | 2133 | } |
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/ipv4/netfilter/nf_nat_rule.c b/net/ipv4/netfilter/nf_nat_rule.c index bea54a685109..8d489e746b21 100644 --- a/net/ipv4/netfilter/nf_nat_rule.c +++ b/net/ipv4/netfilter/nf_nat_rule.c | |||
@@ -61,7 +61,7 @@ static struct | |||
61 | static struct xt_table nat_table = { | 61 | static struct xt_table nat_table = { |
62 | .name = "nat", | 62 | .name = "nat", |
63 | .valid_hooks = NAT_VALID_HOOKS, | 63 | .valid_hooks = NAT_VALID_HOOKS, |
64 | .lock = __RW_LOCK_UNLOCKED(__nat_table.lock), | 64 | .lock = __RW_LOCK_UNLOCKED(nat_table.lock), |
65 | .me = THIS_MODULE, | 65 | .me = THIS_MODULE, |
66 | .af = AF_INET, | 66 | .af = AF_INET, |
67 | }; | 67 | }; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index ba85d8831893..fe3b4bdfd251 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1028,10 +1028,6 @@ unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu) | |||
1028 | 1028 | ||
1029 | /* Compute the current effective MSS, taking SACKs and IP options, | 1029 | /* Compute the current effective MSS, taking SACKs and IP options, |
1030 | * and even PMTU discovery events into account. | 1030 | * and even PMTU discovery events into account. |
1031 | * | ||
1032 | * LARGESEND note: !tcp_urg_mode is overkill, only frames up to snd_up | ||
1033 | * cannot be large. However, taking into account rare use of URG, this | ||
1034 | * is not a big flaw. | ||
1035 | */ | 1031 | */ |
1036 | unsigned int tcp_current_mss(struct sock *sk, int large_allowed) | 1032 | unsigned int tcp_current_mss(struct sock *sk, int large_allowed) |
1037 | { | 1033 | { |
@@ -1046,7 +1042,7 @@ unsigned int tcp_current_mss(struct sock *sk, int large_allowed) | |||
1046 | 1042 | ||
1047 | mss_now = tp->mss_cache; | 1043 | mss_now = tp->mss_cache; |
1048 | 1044 | ||
1049 | if (large_allowed && sk_can_gso(sk) && !tcp_urg_mode(tp)) | 1045 | if (large_allowed && sk_can_gso(sk)) |
1050 | doing_tso = 1; | 1046 | doing_tso = 1; |
1051 | 1047 | ||
1052 | if (dst) { | 1048 | if (dst) { |
@@ -1516,6 +1512,10 @@ static int tcp_mtu_probe(struct sock *sk) | |||
1516 | * send_head. This happens as incoming acks open up the remote | 1512 | * send_head. This happens as incoming acks open up the remote |
1517 | * window for us. | 1513 | * window for us. |
1518 | * | 1514 | * |
1515 | * LARGESEND note: !tcp_urg_mode is overkill, only frames between | ||
1516 | * snd_up-64k-mss .. snd_up cannot be large. However, taking into | ||
1517 | * account rare use of URG, this is not a big flaw. | ||
1518 | * | ||
1519 | * Returns 1, if no segments are in flight and we have queued segments, but | 1519 | * Returns 1, if no segments are in flight and we have queued segments, but |
1520 | * cannot send anything now because of SWS or another problem. | 1520 | * cannot send anything now because of SWS or another problem. |
1521 | */ | 1521 | */ |
@@ -1567,7 +1567,7 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle) | |||
1567 | } | 1567 | } |
1568 | 1568 | ||
1569 | limit = mss_now; | 1569 | limit = mss_now; |
1570 | if (tso_segs > 1) | 1570 | if (tso_segs > 1 && !tcp_urg_mode(tp)) |
1571 | limit = tcp_mss_split_point(sk, skb, mss_now, | 1571 | limit = tcp_mss_split_point(sk, skb, mss_now, |
1572 | cwnd_quota); | 1572 | cwnd_quota); |
1573 | 1573 | ||
@@ -1616,6 +1616,7 @@ void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, | |||
1616 | */ | 1616 | */ |
1617 | void tcp_push_one(struct sock *sk, unsigned int mss_now) | 1617 | void tcp_push_one(struct sock *sk, unsigned int mss_now) |
1618 | { | 1618 | { |
1619 | struct tcp_sock *tp = tcp_sk(sk); | ||
1619 | struct sk_buff *skb = tcp_send_head(sk); | 1620 | struct sk_buff *skb = tcp_send_head(sk); |
1620 | unsigned int tso_segs, cwnd_quota; | 1621 | unsigned int tso_segs, cwnd_quota; |
1621 | 1622 | ||
@@ -1630,7 +1631,7 @@ void tcp_push_one(struct sock *sk, unsigned int mss_now) | |||
1630 | BUG_ON(!tso_segs); | 1631 | BUG_ON(!tso_segs); |
1631 | 1632 | ||
1632 | limit = mss_now; | 1633 | limit = mss_now; |
1633 | if (tso_segs > 1) | 1634 | if (tso_segs > 1 && !tcp_urg_mode(tp)) |
1634 | limit = tcp_mss_split_point(sk, skb, mss_now, | 1635 | limit = tcp_mss_split_point(sk, skb, mss_now, |
1635 | cwnd_quota); | 1636 | cwnd_quota); |
1636 | 1637 | ||
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c index 14504dada116..a453aac91bd3 100644 --- a/net/ipv4/tcp_vegas.c +++ b/net/ipv4/tcp_vegas.c | |||
@@ -40,18 +40,14 @@ | |||
40 | 40 | ||
41 | #include "tcp_vegas.h" | 41 | #include "tcp_vegas.h" |
42 | 42 | ||
43 | /* Default values of the Vegas variables, in fixed-point representation | 43 | static int alpha = 2; |
44 | * with V_PARAM_SHIFT bits to the right of the binary point. | 44 | static int beta = 4; |
45 | */ | 45 | static int gamma = 1; |
46 | #define V_PARAM_SHIFT 1 | ||
47 | static int alpha = 2<<V_PARAM_SHIFT; | ||
48 | static int beta = 4<<V_PARAM_SHIFT; | ||
49 | static int gamma = 1<<V_PARAM_SHIFT; | ||
50 | 46 | ||
51 | module_param(alpha, int, 0644); | 47 | module_param(alpha, int, 0644); |
52 | MODULE_PARM_DESC(alpha, "lower bound of packets in network (scale by 2)"); | 48 | MODULE_PARM_DESC(alpha, "lower bound of packets in network"); |
53 | module_param(beta, int, 0644); | 49 | module_param(beta, int, 0644); |
54 | MODULE_PARM_DESC(beta, "upper bound of packets in network (scale by 2)"); | 50 | MODULE_PARM_DESC(beta, "upper bound of packets in network"); |
55 | module_param(gamma, int, 0644); | 51 | module_param(gamma, int, 0644); |
56 | MODULE_PARM_DESC(gamma, "limit on increase (scale by 2)"); | 52 | MODULE_PARM_DESC(gamma, "limit on increase (scale by 2)"); |
57 | 53 | ||
@@ -172,49 +168,13 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
172 | return; | 168 | return; |
173 | } | 169 | } |
174 | 170 | ||
175 | /* The key players are v_beg_snd_una and v_beg_snd_nxt. | ||
176 | * | ||
177 | * These are so named because they represent the approximate values | ||
178 | * of snd_una and snd_nxt at the beginning of the current RTT. More | ||
179 | * precisely, they represent the amount of data sent during the RTT. | ||
180 | * At the end of the RTT, when we receive an ACK for v_beg_snd_nxt, | ||
181 | * we will calculate that (v_beg_snd_nxt - v_beg_snd_una) outstanding | ||
182 | * bytes of data have been ACKed during the course of the RTT, giving | ||
183 | * an "actual" rate of: | ||
184 | * | ||
185 | * (v_beg_snd_nxt - v_beg_snd_una) / (rtt duration) | ||
186 | * | ||
187 | * Unfortunately, v_beg_snd_una is not exactly equal to snd_una, | ||
188 | * because delayed ACKs can cover more than one segment, so they | ||
189 | * don't line up nicely with the boundaries of RTTs. | ||
190 | * | ||
191 | * Another unfortunate fact of life is that delayed ACKs delay the | ||
192 | * advance of the left edge of our send window, so that the number | ||
193 | * of bytes we send in an RTT is often less than our cwnd will allow. | ||
194 | * So we keep track of our cwnd separately, in v_beg_snd_cwnd. | ||
195 | */ | ||
196 | |||
197 | if (after(ack, vegas->beg_snd_nxt)) { | 171 | if (after(ack, vegas->beg_snd_nxt)) { |
198 | /* Do the Vegas once-per-RTT cwnd adjustment. */ | 172 | /* Do the Vegas once-per-RTT cwnd adjustment. */ |
199 | u32 old_wnd, old_snd_cwnd; | ||
200 | |||
201 | |||
202 | /* Here old_wnd is essentially the window of data that was | ||
203 | * sent during the previous RTT, and has all | ||
204 | * been acknowledged in the course of the RTT that ended | ||
205 | * with the ACK we just received. Likewise, old_snd_cwnd | ||
206 | * is the cwnd during the previous RTT. | ||
207 | */ | ||
208 | old_wnd = (vegas->beg_snd_nxt - vegas->beg_snd_una) / | ||
209 | tp->mss_cache; | ||
210 | old_snd_cwnd = vegas->beg_snd_cwnd; | ||
211 | 173 | ||
212 | /* Save the extent of the current window so we can use this | 174 | /* Save the extent of the current window so we can use this |
213 | * at the end of the next RTT. | 175 | * at the end of the next RTT. |
214 | */ | 176 | */ |
215 | vegas->beg_snd_una = vegas->beg_snd_nxt; | ||
216 | vegas->beg_snd_nxt = tp->snd_nxt; | 177 | vegas->beg_snd_nxt = tp->snd_nxt; |
217 | vegas->beg_snd_cwnd = tp->snd_cwnd; | ||
218 | 178 | ||
219 | /* We do the Vegas calculations only if we got enough RTT | 179 | /* We do the Vegas calculations only if we got enough RTT |
220 | * samples that we can be reasonably sure that we got | 180 | * samples that we can be reasonably sure that we got |
@@ -252,22 +212,14 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
252 | * | 212 | * |
253 | * This is: | 213 | * This is: |
254 | * (actual rate in segments) * baseRTT | 214 | * (actual rate in segments) * baseRTT |
255 | * We keep it as a fixed point number with | ||
256 | * V_PARAM_SHIFT bits to the right of the binary point. | ||
257 | */ | 215 | */ |
258 | target_cwnd = ((u64)old_wnd * vegas->baseRTT); | 216 | target_cwnd = tp->snd_cwnd * vegas->baseRTT / rtt; |
259 | target_cwnd <<= V_PARAM_SHIFT; | ||
260 | do_div(target_cwnd, rtt); | ||
261 | 217 | ||
262 | /* Calculate the difference between the window we had, | 218 | /* Calculate the difference between the window we had, |
263 | * and the window we would like to have. This quantity | 219 | * and the window we would like to have. This quantity |
264 | * is the "Diff" from the Arizona Vegas papers. | 220 | * is the "Diff" from the Arizona Vegas papers. |
265 | * | ||
266 | * Again, this is a fixed point number with | ||
267 | * V_PARAM_SHIFT bits to the right of the binary | ||
268 | * point. | ||
269 | */ | 221 | */ |
270 | diff = (old_wnd << V_PARAM_SHIFT) - target_cwnd; | 222 | diff = tp->snd_cwnd * (rtt-vegas->baseRTT) / vegas->baseRTT; |
271 | 223 | ||
272 | if (diff > gamma && tp->snd_ssthresh > 2 ) { | 224 | if (diff > gamma && tp->snd_ssthresh > 2 ) { |
273 | /* Going too fast. Time to slow down | 225 | /* Going too fast. Time to slow down |
@@ -282,16 +234,13 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
282 | * truncation robs us of full link | 234 | * truncation robs us of full link |
283 | * utilization. | 235 | * utilization. |
284 | */ | 236 | */ |
285 | tp->snd_cwnd = min(tp->snd_cwnd, | 237 | tp->snd_cwnd = min(tp->snd_cwnd, (u32)target_cwnd+1); |
286 | ((u32)target_cwnd >> | ||
287 | V_PARAM_SHIFT)+1); | ||
288 | 238 | ||
289 | } else if (tp->snd_cwnd <= tp->snd_ssthresh) { | 239 | } else if (tp->snd_cwnd <= tp->snd_ssthresh) { |
290 | /* Slow start. */ | 240 | /* Slow start. */ |
291 | tcp_slow_start(tp); | 241 | tcp_slow_start(tp); |
292 | } else { | 242 | } else { |
293 | /* Congestion avoidance. */ | 243 | /* Congestion avoidance. */ |
294 | u32 next_snd_cwnd; | ||
295 | 244 | ||
296 | /* Figure out where we would like cwnd | 245 | /* Figure out where we would like cwnd |
297 | * to be. | 246 | * to be. |
@@ -300,32 +249,25 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
300 | /* The old window was too fast, so | 249 | /* The old window was too fast, so |
301 | * we slow down. | 250 | * we slow down. |
302 | */ | 251 | */ |
303 | next_snd_cwnd = old_snd_cwnd - 1; | 252 | tp->snd_cwnd--; |
304 | } else if (diff < alpha) { | 253 | } else if (diff < alpha) { |
305 | /* We don't have enough extra packets | 254 | /* We don't have enough extra packets |
306 | * in the network, so speed up. | 255 | * in the network, so speed up. |
307 | */ | 256 | */ |
308 | next_snd_cwnd = old_snd_cwnd + 1; | 257 | tp->snd_cwnd++; |
309 | } else { | 258 | } else { |
310 | /* Sending just as fast as we | 259 | /* Sending just as fast as we |
311 | * should be. | 260 | * should be. |
312 | */ | 261 | */ |
313 | next_snd_cwnd = old_snd_cwnd; | ||
314 | } | 262 | } |
315 | |||
316 | /* Adjust cwnd upward or downward, toward the | ||
317 | * desired value. | ||
318 | */ | ||
319 | if (next_snd_cwnd > tp->snd_cwnd) | ||
320 | tp->snd_cwnd++; | ||
321 | else if (next_snd_cwnd < tp->snd_cwnd) | ||
322 | tp->snd_cwnd--; | ||
323 | } | 263 | } |
324 | 264 | ||
325 | if (tp->snd_cwnd < 2) | 265 | if (tp->snd_cwnd < 2) |
326 | tp->snd_cwnd = 2; | 266 | tp->snd_cwnd = 2; |
327 | else if (tp->snd_cwnd > tp->snd_cwnd_clamp) | 267 | else if (tp->snd_cwnd > tp->snd_cwnd_clamp) |
328 | tp->snd_cwnd = tp->snd_cwnd_clamp; | 268 | tp->snd_cwnd = tp->snd_cwnd_clamp; |
269 | |||
270 | tp->snd_ssthresh = tcp_current_ssthresh(sk); | ||
329 | } | 271 | } |
330 | 272 | ||
331 | /* Wipe the slate clean for the next RTT. */ | 273 | /* Wipe the slate clean for the next RTT. */ |
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/ndisc.c b/net/ipv6/ndisc.c index 172438320eec..d0f54d18e19b 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -912,8 +912,13 @@ static void ndisc_recv_na(struct sk_buff *skb) | |||
912 | is invalid, but ndisc specs say nothing | 912 | is invalid, but ndisc specs say nothing |
913 | about it. It could be misconfiguration, or | 913 | about it. It could be misconfiguration, or |
914 | an smart proxy agent tries to help us :-) | 914 | an smart proxy agent tries to help us :-) |
915 | |||
916 | We should not print the error if NA has been | ||
917 | received from loopback - it is just our own | ||
918 | unsolicited advertisement. | ||
915 | */ | 919 | */ |
916 | ND_PRINTK1(KERN_WARNING | 920 | if (skb->pkt_type != PACKET_LOOPBACK) |
921 | ND_PRINTK1(KERN_WARNING | ||
917 | "ICMPv6 NA: someone advertises our address on %s!\n", | 922 | "ICMPv6 NA: someone advertises our address on %s!\n", |
918 | ifp->idev->dev->name); | 923 | ifp->idev->dev->name); |
919 | in6_ifa_put(ifp); | 924 | in6_ifa_put(ifp); |
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, | |||
957 | EXPORT_SYMBOL(iucv_message_purge); | 960 | EXPORT_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 | */ | ||
974 | static 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 | */ |
974 | int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg, | 1024 | int __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 | } | ||
1050 | EXPORT_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 | */ | ||
1069 | int 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, | |||
1101 | EXPORT_SYMBOL(iucv_message_reply); | 1155 | EXPORT_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 | */ |
1118 | int iucv_message_send(struct iucv_path *path, struct iucv_message *msg, | 1174 | int __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 | } | ||
1204 | EXPORT_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 | */ | ||
1223 | int 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/mac80211/sta_info.c b/net/mac80211/sta_info.c index 7fef8ea1f5ec..d254446b85b5 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -99,7 +99,7 @@ struct sta_info *sta_info_get(struct ieee80211_local *local, const u8 *addr) | |||
99 | 99 | ||
100 | sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]); | 100 | sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]); |
101 | while (sta) { | 101 | while (sta) { |
102 | if (compare_ether_addr(sta->sta.addr, addr) == 0) | 102 | if (memcmp(sta->sta.addr, addr, ETH_ALEN) == 0) |
103 | break; | 103 | break; |
104 | sta = rcu_dereference(sta->hnext); | 104 | sta = rcu_dereference(sta->hnext); |
105 | } | 105 | } |
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 742f811ca416..ab4ddba874be 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -271,6 +271,7 @@ static int ieee80211_ioctl_siwmode(struct net_device *dev, | |||
271 | __u32 *mode, char *extra) | 271 | __u32 *mode, char *extra) |
272 | { | 272 | { |
273 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 273 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
274 | struct ieee80211_local *local = sdata->local; | ||
274 | int type; | 275 | int type; |
275 | 276 | ||
276 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 277 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
@@ -281,6 +282,13 @@ static int ieee80211_ioctl_siwmode(struct net_device *dev, | |||
281 | type = NL80211_IFTYPE_STATION; | 282 | type = NL80211_IFTYPE_STATION; |
282 | break; | 283 | break; |
283 | case IW_MODE_ADHOC: | 284 | case IW_MODE_ADHOC: |
285 | /* Setting ad-hoc mode on non ibss channel is not | ||
286 | * supported. | ||
287 | */ | ||
288 | if (local->oper_channel && | ||
289 | (local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS)) | ||
290 | return -EOPNOTSUPP; | ||
291 | |||
284 | type = NL80211_IFTYPE_ADHOC; | 292 | type = NL80211_IFTYPE_ADHOC; |
285 | break; | 293 | break; |
286 | case IW_MODE_REPEAT: | 294 | case IW_MODE_REPEAT: |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 622d7c671cb7..233fdd2d7d21 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -305,9 +305,7 @@ void nf_conntrack_hash_insert(struct nf_conn *ct) | |||
305 | hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); | 305 | hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); |
306 | repl_hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); | 306 | repl_hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); |
307 | 307 | ||
308 | spin_lock_bh(&nf_conntrack_lock); | ||
309 | __nf_conntrack_hash_insert(ct, hash, repl_hash); | 308 | __nf_conntrack_hash_insert(ct, hash, repl_hash); |
310 | spin_unlock_bh(&nf_conntrack_lock); | ||
311 | } | 309 | } |
312 | EXPORT_SYMBOL_GPL(nf_conntrack_hash_insert); | 310 | EXPORT_SYMBOL_GPL(nf_conntrack_hash_insert); |
313 | 311 | ||
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index a040d46f85d6..5f4a6516b3b6 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -1090,7 +1090,7 @@ ctnetlink_create_conntrack(struct nlattr *cda[], | |||
1090 | struct nf_conn_help *help; | 1090 | struct nf_conn_help *help; |
1091 | struct nf_conntrack_helper *helper; | 1091 | struct nf_conntrack_helper *helper; |
1092 | 1092 | ||
1093 | ct = nf_conntrack_alloc(&init_net, otuple, rtuple, GFP_KERNEL); | 1093 | ct = nf_conntrack_alloc(&init_net, otuple, rtuple, GFP_ATOMIC); |
1094 | if (ct == NULL || IS_ERR(ct)) | 1094 | if (ct == NULL || IS_ERR(ct)) |
1095 | return -ENOMEM; | 1095 | return -ENOMEM; |
1096 | 1096 | ||
@@ -1138,7 +1138,7 @@ ctnetlink_create_conntrack(struct nlattr *cda[], | |||
1138 | } | 1138 | } |
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | nf_ct_acct_ext_add(ct, GFP_KERNEL); | 1141 | nf_ct_acct_ext_add(ct, GFP_ATOMIC); |
1142 | 1142 | ||
1143 | #if defined(CONFIG_NF_CONNTRACK_MARK) | 1143 | #if defined(CONFIG_NF_CONNTRACK_MARK) |
1144 | if (cda[CTA_MARK]) | 1144 | if (cda[CTA_MARK]) |
@@ -1212,13 +1212,14 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb, | |||
1212 | atomic_inc(&master_ct->ct_general.use); | 1212 | atomic_inc(&master_ct->ct_general.use); |
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | spin_unlock_bh(&nf_conntrack_lock); | ||
1216 | err = -ENOENT; | 1215 | err = -ENOENT; |
1217 | if (nlh->nlmsg_flags & NLM_F_CREATE) | 1216 | if (nlh->nlmsg_flags & NLM_F_CREATE) |
1218 | err = ctnetlink_create_conntrack(cda, | 1217 | err = ctnetlink_create_conntrack(cda, |
1219 | &otuple, | 1218 | &otuple, |
1220 | &rtuple, | 1219 | &rtuple, |
1221 | master_ct); | 1220 | master_ct); |
1221 | spin_unlock_bh(&nf_conntrack_lock); | ||
1222 | |||
1222 | if (err < 0 && master_ct) | 1223 | if (err < 0 && master_ct) |
1223 | nf_ct_put(master_ct); | 1224 | nf_ct_put(master_ct); |
1224 | 1225 | ||
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/netfilter/xt_socket.c b/net/netfilter/xt_socket.c index 02a8fed21082..1acc089be7e9 100644 --- a/net/netfilter/xt_socket.c +++ b/net/netfilter/xt_socket.c | |||
@@ -141,7 +141,7 @@ socket_mt(const struct sk_buff *skb, const struct xt_match_param *par) | |||
141 | sk = nf_tproxy_get_sock_v4(dev_net(skb->dev), protocol, | 141 | sk = nf_tproxy_get_sock_v4(dev_net(skb->dev), protocol, |
142 | saddr, daddr, sport, dport, par->in, false); | 142 | saddr, daddr, sport, dport, par->in, false); |
143 | if (sk != NULL) { | 143 | if (sk != NULL) { |
144 | bool wildcard = (inet_sk(sk)->rcv_saddr == 0); | 144 | bool wildcard = (sk->sk_state != TCP_TIME_WAIT && inet_sk(sk)->rcv_saddr == 0); |
145 | 145 | ||
146 | nf_tproxy_put_sock(sk); | 146 | nf_tproxy_put_sock(sk); |
147 | if (wildcard) | 147 | if (wildcard) |
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index e8a5c32b0f10..8c0308032178 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -562,7 +562,6 @@ static int netlbl_unlhsh_remove_addr4(struct net *net, | |||
562 | const struct in_addr *mask, | 562 | const struct in_addr *mask, |
563 | struct netlbl_audit *audit_info) | 563 | struct netlbl_audit *audit_info) |
564 | { | 564 | { |
565 | int ret_val = 0; | ||
566 | struct netlbl_af4list *list_entry; | 565 | struct netlbl_af4list *list_entry; |
567 | struct netlbl_unlhsh_addr4 *entry; | 566 | struct netlbl_unlhsh_addr4 *entry; |
568 | struct audit_buffer *audit_buf; | 567 | struct audit_buffer *audit_buf; |
@@ -574,9 +573,10 @@ static int netlbl_unlhsh_remove_addr4(struct net *net, | |||
574 | list_entry = netlbl_af4list_remove(addr->s_addr, mask->s_addr, | 573 | list_entry = netlbl_af4list_remove(addr->s_addr, mask->s_addr, |
575 | &iface->addr4_list); | 574 | &iface->addr4_list); |
576 | spin_unlock(&netlbl_unlhsh_lock); | 575 | spin_unlock(&netlbl_unlhsh_lock); |
577 | if (list_entry == NULL) | 576 | if (list_entry != NULL) |
578 | ret_val = -ENOENT; | 577 | entry = netlbl_unlhsh_addr4_entry(list_entry); |
579 | entry = netlbl_unlhsh_addr4_entry(list_entry); | 578 | else |
579 | entry = NULL; | ||
580 | 580 | ||
581 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCDEL, | 581 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCDEL, |
582 | audit_info); | 582 | audit_info); |
@@ -587,19 +587,21 @@ static int netlbl_unlhsh_remove_addr4(struct net *net, | |||
587 | addr->s_addr, mask->s_addr); | 587 | addr->s_addr, mask->s_addr); |
588 | if (dev != NULL) | 588 | if (dev != NULL) |
589 | dev_put(dev); | 589 | dev_put(dev); |
590 | if (entry && security_secid_to_secctx(entry->secid, | 590 | if (entry != NULL && |
591 | &secctx, | 591 | security_secid_to_secctx(entry->secid, |
592 | &secctx_len) == 0) { | 592 | &secctx, &secctx_len) == 0) { |
593 | audit_log_format(audit_buf, " sec_obj=%s", secctx); | 593 | audit_log_format(audit_buf, " sec_obj=%s", secctx); |
594 | security_release_secctx(secctx, secctx_len); | 594 | security_release_secctx(secctx, secctx_len); |
595 | } | 595 | } |
596 | audit_log_format(audit_buf, " res=%u", ret_val == 0 ? 1 : 0); | 596 | audit_log_format(audit_buf, " res=%u", entry != NULL ? 1 : 0); |
597 | audit_log_end(audit_buf); | 597 | audit_log_end(audit_buf); |
598 | } | 598 | } |
599 | 599 | ||
600 | if (ret_val == 0) | 600 | if (entry == NULL) |
601 | call_rcu(&entry->rcu, netlbl_unlhsh_free_addr4); | 601 | return -ENOENT; |
602 | return ret_val; | 602 | |
603 | call_rcu(&entry->rcu, netlbl_unlhsh_free_addr4); | ||
604 | return 0; | ||
603 | } | 605 | } |
604 | 606 | ||
605 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 607 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
@@ -623,7 +625,6 @@ static int netlbl_unlhsh_remove_addr6(struct net *net, | |||
623 | const struct in6_addr *mask, | 625 | const struct in6_addr *mask, |
624 | struct netlbl_audit *audit_info) | 626 | struct netlbl_audit *audit_info) |
625 | { | 627 | { |
626 | int ret_val = 0; | ||
627 | struct netlbl_af6list *list_entry; | 628 | struct netlbl_af6list *list_entry; |
628 | struct netlbl_unlhsh_addr6 *entry; | 629 | struct netlbl_unlhsh_addr6 *entry; |
629 | struct audit_buffer *audit_buf; | 630 | struct audit_buffer *audit_buf; |
@@ -634,9 +635,10 @@ static int netlbl_unlhsh_remove_addr6(struct net *net, | |||
634 | spin_lock(&netlbl_unlhsh_lock); | 635 | spin_lock(&netlbl_unlhsh_lock); |
635 | list_entry = netlbl_af6list_remove(addr, mask, &iface->addr6_list); | 636 | list_entry = netlbl_af6list_remove(addr, mask, &iface->addr6_list); |
636 | spin_unlock(&netlbl_unlhsh_lock); | 637 | spin_unlock(&netlbl_unlhsh_lock); |
637 | if (list_entry == NULL) | 638 | if (list_entry != NULL) |
638 | ret_val = -ENOENT; | 639 | entry = netlbl_unlhsh_addr6_entry(list_entry); |
639 | entry = netlbl_unlhsh_addr6_entry(list_entry); | 640 | else |
641 | entry = NULL; | ||
640 | 642 | ||
641 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCDEL, | 643 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCDEL, |
642 | audit_info); | 644 | audit_info); |
@@ -647,19 +649,21 @@ static int netlbl_unlhsh_remove_addr6(struct net *net, | |||
647 | addr, mask); | 649 | addr, mask); |
648 | if (dev != NULL) | 650 | if (dev != NULL) |
649 | dev_put(dev); | 651 | dev_put(dev); |
650 | if (entry && security_secid_to_secctx(entry->secid, | 652 | if (entry != NULL && |
651 | &secctx, | 653 | security_secid_to_secctx(entry->secid, |
652 | &secctx_len) == 0) { | 654 | &secctx, &secctx_len) == 0) { |
653 | audit_log_format(audit_buf, " sec_obj=%s", secctx); | 655 | audit_log_format(audit_buf, " sec_obj=%s", secctx); |
654 | security_release_secctx(secctx, secctx_len); | 656 | security_release_secctx(secctx, secctx_len); |
655 | } | 657 | } |
656 | audit_log_format(audit_buf, " res=%u", ret_val == 0 ? 1 : 0); | 658 | audit_log_format(audit_buf, " res=%u", entry != NULL ? 1 : 0); |
657 | audit_log_end(audit_buf); | 659 | audit_log_end(audit_buf); |
658 | } | 660 | } |
659 | 661 | ||
660 | if (ret_val == 0) | 662 | if (entry == NULL) |
661 | call_rcu(&entry->rcu, netlbl_unlhsh_free_addr6); | 663 | return -ENOENT; |
662 | return ret_val; | 664 | |
665 | call_rcu(&entry->rcu, netlbl_unlhsh_free_addr6); | ||
666 | return 0; | ||
663 | } | 667 | } |
664 | #endif /* IPv6 */ | 668 | #endif /* IPv6 */ |
665 | 669 | ||
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/phonet/pep-gprs.c b/net/phonet/pep-gprs.c index 9978afbd9f2a..803eeef0aa85 100644 --- a/net/phonet/pep-gprs.c +++ b/net/phonet/pep-gprs.c | |||
@@ -155,12 +155,13 @@ static void gprs_data_ready(struct sock *sk, int len) | |||
155 | static void gprs_write_space(struct sock *sk) | 155 | static void gprs_write_space(struct sock *sk) |
156 | { | 156 | { |
157 | struct gprs_dev *dev = sk->sk_user_data; | 157 | struct gprs_dev *dev = sk->sk_user_data; |
158 | struct net_device *net = dev->net; | ||
158 | unsigned credits = pep_writeable(sk); | 159 | unsigned credits = pep_writeable(sk); |
159 | 160 | ||
160 | spin_lock_bh(&dev->tx_lock); | 161 | spin_lock_bh(&dev->tx_lock); |
161 | dev->tx_max = credits; | 162 | dev->tx_max = credits; |
162 | if (credits > skb_queue_len(&dev->tx_queue)) | 163 | if (credits > skb_queue_len(&dev->tx_queue) && netif_running(net)) |
163 | netif_wake_queue(dev->net); | 164 | netif_wake_queue(net); |
164 | spin_unlock_bh(&dev->tx_lock); | 165 | spin_unlock_bh(&dev->tx_lock); |
165 | } | 166 | } |
166 | 167 | ||
@@ -168,6 +169,23 @@ static void gprs_write_space(struct sock *sk) | |||
168 | * Network device callbacks | 169 | * Network device callbacks |
169 | */ | 170 | */ |
170 | 171 | ||
172 | static int gprs_open(struct net_device *dev) | ||
173 | { | ||
174 | struct gprs_dev *gp = netdev_priv(dev); | ||
175 | |||
176 | gprs_write_space(gp->sk); | ||
177 | return 0; | ||
178 | } | ||
179 | |||
180 | static int gprs_close(struct net_device *dev) | ||
181 | { | ||
182 | struct gprs_dev *gp = netdev_priv(dev); | ||
183 | |||
184 | netif_stop_queue(dev); | ||
185 | flush_work(&gp->tx_work); | ||
186 | return 0; | ||
187 | } | ||
188 | |||
171 | static int gprs_xmit(struct sk_buff *skb, struct net_device *net) | 189 | static int gprs_xmit(struct sk_buff *skb, struct net_device *net) |
172 | { | 190 | { |
173 | struct gprs_dev *dev = netdev_priv(net); | 191 | struct gprs_dev *dev = netdev_priv(net); |
@@ -254,6 +272,8 @@ static void gprs_setup(struct net_device *net) | |||
254 | net->tx_queue_len = 10; | 272 | net->tx_queue_len = 10; |
255 | 273 | ||
256 | net->destructor = free_netdev; | 274 | net->destructor = free_netdev; |
275 | net->open = gprs_open; | ||
276 | net->stop = gprs_close; | ||
257 | net->hard_start_xmit = gprs_xmit; /* mandatory */ | 277 | net->hard_start_xmit = gprs_xmit; /* mandatory */ |
258 | net->change_mtu = gprs_set_mtu; | 278 | net->change_mtu = gprs_set_mtu; |
259 | net->get_stats = gprs_get_stats; | 279 | net->get_stats = gprs_get_stats; |
@@ -318,7 +338,6 @@ int gprs_attach(struct sock *sk) | |||
318 | dev->sk = sk; | 338 | dev->sk = sk; |
319 | 339 | ||
320 | printk(KERN_DEBUG"%s: attached\n", net->name); | 340 | printk(KERN_DEBUG"%s: attached\n", net->name); |
321 | gprs_write_space(sk); /* kick off TX */ | ||
322 | return net->ifindex; | 341 | return net->ifindex; |
323 | 342 | ||
324 | out_rel: | 343 | out_rel: |
@@ -341,7 +360,5 @@ void gprs_detach(struct sock *sk) | |||
341 | 360 | ||
342 | printk(KERN_DEBUG"%s: detached\n", net->name); | 361 | printk(KERN_DEBUG"%s: detached\n", net->name); |
343 | unregister_netdev(net); | 362 | unregister_netdev(net); |
344 | flush_scheduled_work(); | ||
345 | sock_put(sk); | 363 | sock_put(sk); |
346 | skb_queue_purge(&dev->tx_queue); | ||
347 | } | 364 | } |
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c index 53be9fc82aaa..f93ff8ef47d0 100644 --- a/net/phonet/pn_dev.c +++ b/net/phonet/pn_dev.c | |||
@@ -115,7 +115,7 @@ int phonet_address_del(struct net_device *dev, u8 addr) | |||
115 | pnd = __phonet_get(dev); | 115 | pnd = __phonet_get(dev); |
116 | if (!pnd || !test_and_clear_bit(addr >> 2, pnd->addrs)) | 116 | if (!pnd || !test_and_clear_bit(addr >> 2, pnd->addrs)) |
117 | err = -EADDRNOTAVAIL; | 117 | err = -EADDRNOTAVAIL; |
118 | if (bitmap_empty(pnd->addrs, 64)) | 118 | else if (bitmap_empty(pnd->addrs, 64)) |
119 | __phonet_device_free(pnd); | 119 | __phonet_device_free(pnd); |
120 | spin_unlock_bh(&pndevs.lock); | 120 | spin_unlock_bh(&pndevs.lock); |
121 | return err; | 121 | return err; |
diff --git a/net/phonet/pn_netlink.c b/net/phonet/pn_netlink.c index b1770d66bc8d..242fe8f8c322 100644 --- a/net/phonet/pn_netlink.c +++ b/net/phonet/pn_netlink.c | |||
@@ -123,6 +123,7 @@ nla_put_failure: | |||
123 | 123 | ||
124 | static int getaddr_dumpit(struct sk_buff *skb, struct netlink_callback *cb) | 124 | static int getaddr_dumpit(struct sk_buff *skb, struct netlink_callback *cb) |
125 | { | 125 | { |
126 | struct net *net = sock_net(skb->sk); | ||
126 | struct phonet_device *pnd; | 127 | struct phonet_device *pnd; |
127 | int dev_idx = 0, dev_start_idx = cb->args[0]; | 128 | int dev_idx = 0, dev_start_idx = cb->args[0]; |
128 | int addr_idx = 0, addr_start_idx = cb->args[1]; | 129 | int addr_idx = 0, addr_start_idx = cb->args[1]; |
@@ -131,6 +132,8 @@ static int getaddr_dumpit(struct sk_buff *skb, struct netlink_callback *cb) | |||
131 | list_for_each_entry(pnd, &pndevs.list, list) { | 132 | list_for_each_entry(pnd, &pndevs.list, list) { |
132 | u8 addr; | 133 | u8 addr; |
133 | 134 | ||
135 | if (!net_eq(dev_net(pnd->netdev), net)) | ||
136 | continue; | ||
134 | if (dev_idx > dev_start_idx) | 137 | if (dev_idx > dev_start_idx) |
135 | addr_start_idx = 0; | 138 | addr_start_idx = 0; |
136 | if (dev_idx++ < dev_start_idx) | 139 | if (dev_idx++ < dev_start_idx) |
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index a7f1ce11bc22..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; |
@@ -1072,6 +1072,10 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1072 | unsigned char *asmptr; | 1072 | unsigned char *asmptr; |
1073 | int n, size, qbit = 0; | 1073 | int n, size, qbit = 0; |
1074 | 1074 | ||
1075 | /* ROSE empty frame has no meaning : don't send */ | ||
1076 | if (len == 0) | ||
1077 | return 0; | ||
1078 | |||
1075 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) | 1079 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) |
1076 | return -EINVAL; | 1080 | return -EINVAL; |
1077 | 1081 | ||
@@ -1265,6 +1269,12 @@ static int rose_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1265 | skb_reset_transport_header(skb); | 1269 | skb_reset_transport_header(skb); |
1266 | copied = skb->len; | 1270 | copied = skb->len; |
1267 | 1271 | ||
1272 | /* ROSE empty frame has no meaning : ignore it */ | ||
1273 | if (copied == 0) { | ||
1274 | skb_free_datagram(sk, skb); | ||
1275 | return copied; | ||
1276 | } | ||
1277 | |||
1268 | if (copied > size) { | 1278 | if (copied > size) { |
1269 | copied = size; | 1279 | copied = size; |
1270 | msg->msg_flags |= MSG_TRUNC; | 1280 | msg->msg_flags |= MSG_TRUNC; |
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 | */ |
341 | struct key *rxrpc_get_null_key(const char *keyname) | 342 | struct 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) | |||
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 | ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index a11959908d9a..98402f0efa47 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -46,9 +46,6 @@ | |||
46 | layering other disciplines. It does not need to do bandwidth | 46 | layering other disciplines. It does not need to do bandwidth |
47 | control either since that can be handled by using token | 47 | control either since that can be handled by using token |
48 | bucket or other rate control. | 48 | bucket or other rate control. |
49 | |||
50 | The simulator is limited by the Linux timer resolution | ||
51 | and will create packet bursts on the HZ boundary (1ms). | ||
52 | */ | 49 | */ |
53 | 50 | ||
54 | struct netem_sched_data { | 51 | struct netem_sched_data { |
diff --git a/net/socket.c b/net/socket.c index 92764d836891..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); |
@@ -2307,6 +2307,7 @@ int kernel_accept(struct socket *sock, struct socket **newsock, int flags) | |||
2307 | } | 2307 | } |
2308 | 2308 | ||
2309 | (*newsock)->ops = sock->ops; | 2309 | (*newsock)->ops = sock->ops; |
2310 | __module_get((*newsock)->ops->owner); | ||
2310 | 2311 | ||
2311 | done: | 2312 | done: |
2312 | return err; | 2313 | return err; |
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); | |||
350 | struct rpc_cred * | 350 | struct rpc_cred * |
351 | rpcauth_lookupcred(struct rpc_auth *auth, int flags) | 351 | rpcauth_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/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 95293f549e9c..a1951dcc5776 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -1183,7 +1183,11 @@ int svc_addsock(struct svc_serv *serv, | |||
1183 | else if (so->state > SS_UNCONNECTED) | 1183 | else if (so->state > SS_UNCONNECTED) |
1184 | err = -EISCONN; | 1184 | err = -EISCONN; |
1185 | else { | 1185 | else { |
1186 | svsk = svc_setup_socket(serv, so, &err, SVC_SOCK_DEFAULTS); | 1186 | if (!try_module_get(THIS_MODULE)) |
1187 | err = -ENOENT; | ||
1188 | else | ||
1189 | svsk = svc_setup_socket(serv, so, &err, | ||
1190 | SVC_SOCK_DEFAULTS); | ||
1187 | if (svsk) { | 1191 | if (svsk) { |
1188 | struct sockaddr_storage addr; | 1192 | struct sockaddr_storage addr; |
1189 | struct sockaddr *sin = (struct sockaddr *)&addr; | 1193 | struct sockaddr *sin = (struct sockaddr *)&addr; |
@@ -1196,7 +1200,8 @@ int svc_addsock(struct svc_serv *serv, | |||
1196 | spin_unlock_bh(&serv->sv_lock); | 1200 | spin_unlock_bh(&serv->sv_lock); |
1197 | svc_xprt_received(&svsk->sk_xprt); | 1201 | svc_xprt_received(&svsk->sk_xprt); |
1198 | err = 0; | 1202 | err = 0; |
1199 | } | 1203 | } else |
1204 | module_put(THIS_MODULE); | ||
1200 | } | 1205 | } |
1201 | if (err) { | 1206 | if (err) { |
1202 | sockfd_put(so); | 1207 | sockfd_put(so); |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index eb90f77bb0e2..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 | ||
474 | out_unlock: | 473 | out_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; |
@@ -1343,6 +1342,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1343 | 1342 | ||
1344 | if (NULL == siocb->scm) | 1343 | if (NULL == siocb->scm) |
1345 | siocb->scm = &tmp_scm; | 1344 | siocb->scm = &tmp_scm; |
1345 | wait_for_unix_gc(); | ||
1346 | err = scm_send(sock, msg, siocb->scm); | 1346 | err = scm_send(sock, msg, siocb->scm); |
1347 | if (err < 0) | 1347 | if (err < 0) |
1348 | return err; | 1348 | return err; |
@@ -1493,6 +1493,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1493 | 1493 | ||
1494 | if (NULL == siocb->scm) | 1494 | if (NULL == siocb->scm) |
1495 | siocb->scm = &tmp_scm; | 1495 | siocb->scm = &tmp_scm; |
1496 | wait_for_unix_gc(); | ||
1496 | err = scm_send(sock, msg, siocb->scm); | 1497 | err = scm_send(sock, msg, siocb->scm); |
1497 | if (err < 0) | 1498 | if (err < 0) |
1498 | return err; | 1499 | return err; |
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 6d4a9a8de5ef..abb3ab34cb1e 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -80,6 +80,7 @@ | |||
80 | #include <linux/file.h> | 80 | #include <linux/file.h> |
81 | #include <linux/proc_fs.h> | 81 | #include <linux/proc_fs.h> |
82 | #include <linux/mutex.h> | 82 | #include <linux/mutex.h> |
83 | #include <linux/wait.h> | ||
83 | 84 | ||
84 | #include <net/sock.h> | 85 | #include <net/sock.h> |
85 | #include <net/af_unix.h> | 86 | #include <net/af_unix.h> |
@@ -91,6 +92,7 @@ | |||
91 | static LIST_HEAD(gc_inflight_list); | 92 | static LIST_HEAD(gc_inflight_list); |
92 | static LIST_HEAD(gc_candidates); | 93 | static LIST_HEAD(gc_candidates); |
93 | static DEFINE_SPINLOCK(unix_gc_lock); | 94 | static DEFINE_SPINLOCK(unix_gc_lock); |
95 | static DECLARE_WAIT_QUEUE_HEAD(unix_gc_wait); | ||
94 | 96 | ||
95 | unsigned int unix_tot_inflight; | 97 | unsigned int unix_tot_inflight; |
96 | 98 | ||
@@ -266,12 +268,16 @@ static void inc_inflight_move_tail(struct unix_sock *u) | |||
266 | list_move_tail(&u->link, &gc_candidates); | 268 | list_move_tail(&u->link, &gc_candidates); |
267 | } | 269 | } |
268 | 270 | ||
269 | /* The external entry point: unix_gc() */ | 271 | static bool gc_in_progress = false; |
270 | 272 | ||
271 | void unix_gc(void) | 273 | void wait_for_unix_gc(void) |
272 | { | 274 | { |
273 | static bool gc_in_progress = false; | 275 | wait_event(unix_gc_wait, gc_in_progress == false); |
276 | } | ||
274 | 277 | ||
278 | /* The external entry point: unix_gc() */ | ||
279 | void unix_gc(void) | ||
280 | { | ||
275 | struct unix_sock *u; | 281 | struct unix_sock *u; |
276 | struct unix_sock *next; | 282 | struct unix_sock *next; |
277 | struct sk_buff_head hitlist; | 283 | struct sk_buff_head hitlist; |
@@ -376,6 +382,7 @@ void unix_gc(void) | |||
376 | /* All candidates should have been detached by now. */ | 382 | /* All candidates should have been detached by now. */ |
377 | BUG_ON(!list_empty(&gc_candidates)); | 383 | BUG_ON(!list_empty(&gc_candidates)); |
378 | gc_in_progress = false; | 384 | gc_in_progress = false; |
385 | wake_up(&unix_gc_wait); | ||
379 | 386 | ||
380 | out: | 387 | out: |
381 | spin_unlock(&unix_gc_lock); | 388 | spin_unlock(&unix_gc_lock); |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 626dbb688499..eb3b1a9f9b12 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -343,9 +343,9 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by, | |||
343 | return 0; | 343 | return 0; |
344 | return -EALREADY; | 344 | return -EALREADY; |
345 | } | 345 | } |
346 | if (WARN_ON(!is_alpha2_set(alpha2) || !is_an_alpha2(alpha2)), | 346 | if (WARN(!is_alpha2_set(alpha2) || !is_an_alpha2(alpha2), |
347 | "Invalid Country IE regulatory hint passed " | 347 | "Invalid Country IE regulatory hint passed " |
348 | "to the wireless core\n") | 348 | "to the wireless core\n")) |
349 | return -EINVAL; | 349 | return -EINVAL; |
350 | /* We ignore Country IE hints for now, as we haven't yet | 350 | /* We ignore Country IE hints for now, as we haven't yet |
351 | * added the dot11MultiDomainCapabilityEnabled flag | 351 | * added the dot11MultiDomainCapabilityEnabled flag |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 058f04f54b90..fb216c9adf86 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -817,6 +817,7 @@ int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info) | |||
817 | continue; | 817 | continue; |
818 | hlist_del(&pol->bydst); | 818 | hlist_del(&pol->bydst); |
819 | hlist_del(&pol->byidx); | 819 | hlist_del(&pol->byidx); |
820 | list_del(&pol->walk.all); | ||
820 | write_unlock_bh(&xfrm_policy_lock); | 821 | write_unlock_bh(&xfrm_policy_lock); |
821 | 822 | ||
822 | xfrm_audit_policy_delete(pol, 1, audit_info->loginuid, | 823 | xfrm_audit_policy_delete(pol, 1, audit_info->loginuid, |