diff options
author | David Sterba <dsterba@suse.com> | 2016-02-26 09:38:32 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-02-26 09:38:32 -0500 |
commit | 675d276b322b45e7bf7c616a2847bdc425745b99 (patch) | |
tree | c61e7108034bf1230024880ec8ae46a9617077c2 /net | |
parent | e9ddd77a31e6ba2867b9c33547f6f079d55f7a72 (diff) | |
parent | 73beece9ca07c003e0e4f4825b12be167334d4ad (diff) |
Merge branch 'foreign/liubo/replace-lockup' into for-chris-4.6
Diffstat (limited to 'net')
-rw-r--r-- | net/core/flow_dissector.c | 9 | ||||
-rw-r--r-- | net/core/scm.c | 7 | ||||
-rw-r--r-- | net/core/skbuff.c | 2 | ||||
-rw-r--r-- | net/core/sysctl_net_core.c | 10 | ||||
-rw-r--r-- | net/ipv4/ip_gre.c | 8 | ||||
-rw-r--r-- | net/ipv4/ip_tunnel.c | 20 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 11 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 5 | ||||
-rw-r--r-- | net/ipv6/ip6_flowlabel.c | 5 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 5 | ||||
-rw-r--r-- | net/openvswitch/vport-vxlan.c | 2 | ||||
-rw-r--r-- | net/sctp/socket.c | 9 | ||||
-rw-r--r-- | net/unix/af_unix.c | 4 | ||||
-rw-r--r-- | net/unix/garbage.c | 8 |
15 files changed, 85 insertions, 24 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index d79699c9d1b9..eab81bc80e5c 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c | |||
@@ -208,7 +208,6 @@ ip: | |||
208 | case htons(ETH_P_IPV6): { | 208 | case htons(ETH_P_IPV6): { |
209 | const struct ipv6hdr *iph; | 209 | const struct ipv6hdr *iph; |
210 | struct ipv6hdr _iph; | 210 | struct ipv6hdr _iph; |
211 | __be32 flow_label; | ||
212 | 211 | ||
213 | ipv6: | 212 | ipv6: |
214 | iph = __skb_header_pointer(skb, nhoff, sizeof(_iph), data, hlen, &_iph); | 213 | iph = __skb_header_pointer(skb, nhoff, sizeof(_iph), data, hlen, &_iph); |
@@ -230,8 +229,12 @@ ipv6: | |||
230 | key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; | 229 | key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; |
231 | } | 230 | } |
232 | 231 | ||
233 | flow_label = ip6_flowlabel(iph); | 232 | if ((dissector_uses_key(flow_dissector, |
234 | if (flow_label) { | 233 | FLOW_DISSECTOR_KEY_FLOW_LABEL) || |
234 | (flags & FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL)) && | ||
235 | ip6_flowlabel(iph)) { | ||
236 | __be32 flow_label = ip6_flowlabel(iph); | ||
237 | |||
235 | if (dissector_uses_key(flow_dissector, | 238 | if (dissector_uses_key(flow_dissector, |
236 | FLOW_DISSECTOR_KEY_FLOW_LABEL)) { | 239 | FLOW_DISSECTOR_KEY_FLOW_LABEL)) { |
237 | key_tags = skb_flow_dissector_target(flow_dissector, | 240 | key_tags = skb_flow_dissector_target(flow_dissector, |
diff --git a/net/core/scm.c b/net/core/scm.c index 14596fb37172..2696aefdc148 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
@@ -87,6 +87,7 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) | |||
87 | *fplp = fpl; | 87 | *fplp = fpl; |
88 | fpl->count = 0; | 88 | fpl->count = 0; |
89 | fpl->max = SCM_MAX_FD; | 89 | fpl->max = SCM_MAX_FD; |
90 | fpl->user = NULL; | ||
90 | } | 91 | } |
91 | fpp = &fpl->fp[fpl->count]; | 92 | fpp = &fpl->fp[fpl->count]; |
92 | 93 | ||
@@ -107,6 +108,10 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) | |||
107 | *fpp++ = file; | 108 | *fpp++ = file; |
108 | fpl->count++; | 109 | fpl->count++; |
109 | } | 110 | } |
111 | |||
112 | if (!fpl->user) | ||
113 | fpl->user = get_uid(current_user()); | ||
114 | |||
110 | return num; | 115 | return num; |
111 | } | 116 | } |
112 | 117 | ||
@@ -119,6 +124,7 @@ void __scm_destroy(struct scm_cookie *scm) | |||
119 | scm->fp = NULL; | 124 | scm->fp = NULL; |
120 | for (i=fpl->count-1; i>=0; i--) | 125 | for (i=fpl->count-1; i>=0; i--) |
121 | fput(fpl->fp[i]); | 126 | fput(fpl->fp[i]); |
127 | free_uid(fpl->user); | ||
122 | kfree(fpl); | 128 | kfree(fpl); |
123 | } | 129 | } |
124 | } | 130 | } |
@@ -336,6 +342,7 @@ struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl) | |||
336 | for (i = 0; i < fpl->count; i++) | 342 | for (i = 0; i < fpl->count; i++) |
337 | get_file(fpl->fp[i]); | 343 | get_file(fpl->fp[i]); |
338 | new_fpl->max = new_fpl->count; | 344 | new_fpl->max = new_fpl->count; |
345 | new_fpl->user = get_uid(fpl->user); | ||
339 | } | 346 | } |
340 | return new_fpl; | 347 | return new_fpl; |
341 | } | 348 | } |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index b2df375ec9c2..5bf88f58bee7 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -79,6 +79,8 @@ | |||
79 | 79 | ||
80 | struct kmem_cache *skbuff_head_cache __read_mostly; | 80 | struct kmem_cache *skbuff_head_cache __read_mostly; |
81 | static struct kmem_cache *skbuff_fclone_cache __read_mostly; | 81 | static struct kmem_cache *skbuff_fclone_cache __read_mostly; |
82 | int sysctl_max_skb_frags __read_mostly = MAX_SKB_FRAGS; | ||
83 | EXPORT_SYMBOL(sysctl_max_skb_frags); | ||
82 | 84 | ||
83 | /** | 85 | /** |
84 | * skb_panic - private function for out-of-line support | 86 | * skb_panic - private function for out-of-line support |
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 95b6139d710c..a6beb7b6ae55 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c | |||
@@ -26,6 +26,7 @@ static int zero = 0; | |||
26 | static int one = 1; | 26 | static int one = 1; |
27 | static int min_sndbuf = SOCK_MIN_SNDBUF; | 27 | static int min_sndbuf = SOCK_MIN_SNDBUF; |
28 | static int min_rcvbuf = SOCK_MIN_RCVBUF; | 28 | static int min_rcvbuf = SOCK_MIN_RCVBUF; |
29 | static int max_skb_frags = MAX_SKB_FRAGS; | ||
29 | 30 | ||
30 | static int net_msg_warn; /* Unused, but still a sysctl */ | 31 | static int net_msg_warn; /* Unused, but still a sysctl */ |
31 | 32 | ||
@@ -392,6 +393,15 @@ static struct ctl_table net_core_table[] = { | |||
392 | .mode = 0644, | 393 | .mode = 0644, |
393 | .proc_handler = proc_dointvec | 394 | .proc_handler = proc_dointvec |
394 | }, | 395 | }, |
396 | { | ||
397 | .procname = "max_skb_frags", | ||
398 | .data = &sysctl_max_skb_frags, | ||
399 | .maxlen = sizeof(int), | ||
400 | .mode = 0644, | ||
401 | .proc_handler = proc_dointvec_minmax, | ||
402 | .extra1 = &one, | ||
403 | .extra2 = &max_skb_frags, | ||
404 | }, | ||
395 | { } | 405 | { } |
396 | }; | 406 | }; |
397 | 407 | ||
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 7c51c4e1661f..56fdf4e0dce4 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -1240,6 +1240,14 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name, | |||
1240 | err = ipgre_newlink(net, dev, tb, NULL); | 1240 | err = ipgre_newlink(net, dev, tb, NULL); |
1241 | if (err < 0) | 1241 | if (err < 0) |
1242 | goto out; | 1242 | goto out; |
1243 | |||
1244 | /* openvswitch users expect packet sizes to be unrestricted, | ||
1245 | * so set the largest MTU we can. | ||
1246 | */ | ||
1247 | err = __ip_tunnel_change_mtu(dev, IP_MAX_MTU, false); | ||
1248 | if (err) | ||
1249 | goto out; | ||
1250 | |||
1243 | return dev; | 1251 | return dev; |
1244 | out: | 1252 | out: |
1245 | free_netdev(dev); | 1253 | free_netdev(dev); |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index c7bd72e9b544..89e8861e05fc 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -943,17 +943,31 @@ done: | |||
943 | } | 943 | } |
944 | EXPORT_SYMBOL_GPL(ip_tunnel_ioctl); | 944 | EXPORT_SYMBOL_GPL(ip_tunnel_ioctl); |
945 | 945 | ||
946 | int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu) | 946 | int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict) |
947 | { | 947 | { |
948 | struct ip_tunnel *tunnel = netdev_priv(dev); | 948 | struct ip_tunnel *tunnel = netdev_priv(dev); |
949 | int t_hlen = tunnel->hlen + sizeof(struct iphdr); | 949 | int t_hlen = tunnel->hlen + sizeof(struct iphdr); |
950 | int max_mtu = 0xFFF8 - dev->hard_header_len - t_hlen; | ||
950 | 951 | ||
951 | if (new_mtu < 68 || | 952 | if (new_mtu < 68) |
952 | new_mtu > 0xFFF8 - dev->hard_header_len - t_hlen) | ||
953 | return -EINVAL; | 953 | return -EINVAL; |
954 | |||
955 | if (new_mtu > max_mtu) { | ||
956 | if (strict) | ||
957 | return -EINVAL; | ||
958 | |||
959 | new_mtu = max_mtu; | ||
960 | } | ||
961 | |||
954 | dev->mtu = new_mtu; | 962 | dev->mtu = new_mtu; |
955 | return 0; | 963 | return 0; |
956 | } | 964 | } |
965 | EXPORT_SYMBOL_GPL(__ip_tunnel_change_mtu); | ||
966 | |||
967 | int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu) | ||
968 | { | ||
969 | return __ip_tunnel_change_mtu(dev, new_mtu, true); | ||
970 | } | ||
957 | EXPORT_SYMBOL_GPL(ip_tunnel_change_mtu); | 971 | EXPORT_SYMBOL_GPL(ip_tunnel_change_mtu); |
958 | 972 | ||
959 | static void ip_tunnel_dev_free(struct net_device *dev) | 973 | static void ip_tunnel_dev_free(struct net_device *dev) |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 19746b3fcbbe..0c36ef4a3f86 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -940,7 +940,7 @@ new_segment: | |||
940 | 940 | ||
941 | i = skb_shinfo(skb)->nr_frags; | 941 | i = skb_shinfo(skb)->nr_frags; |
942 | can_coalesce = skb_can_coalesce(skb, i, page, offset); | 942 | can_coalesce = skb_can_coalesce(skb, i, page, offset); |
943 | if (!can_coalesce && i >= MAX_SKB_FRAGS) { | 943 | if (!can_coalesce && i >= sysctl_max_skb_frags) { |
944 | tcp_mark_push(tp, skb); | 944 | tcp_mark_push(tp, skb); |
945 | goto new_segment; | 945 | goto new_segment; |
946 | } | 946 | } |
@@ -1213,7 +1213,7 @@ new_segment: | |||
1213 | 1213 | ||
1214 | if (!skb_can_coalesce(skb, i, pfrag->page, | 1214 | if (!skb_can_coalesce(skb, i, pfrag->page, |
1215 | pfrag->offset)) { | 1215 | pfrag->offset)) { |
1216 | if (i == MAX_SKB_FRAGS || !sg) { | 1216 | if (i == sysctl_max_skb_frags || !sg) { |
1217 | tcp_mark_push(tp, skb); | 1217 | tcp_mark_push(tp, skb); |
1218 | goto new_segment; | 1218 | goto new_segment; |
1219 | } | 1219 | } |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index a4d523709ab3..7f6ff037adaf 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -311,7 +311,7 @@ static void do_redirect(struct sk_buff *skb, struct sock *sk) | |||
311 | 311 | ||
312 | 312 | ||
313 | /* handle ICMP messages on TCP_NEW_SYN_RECV request sockets */ | 313 | /* handle ICMP messages on TCP_NEW_SYN_RECV request sockets */ |
314 | void tcp_req_err(struct sock *sk, u32 seq) | 314 | void tcp_req_err(struct sock *sk, u32 seq, bool abort) |
315 | { | 315 | { |
316 | struct request_sock *req = inet_reqsk(sk); | 316 | struct request_sock *req = inet_reqsk(sk); |
317 | struct net *net = sock_net(sk); | 317 | struct net *net = sock_net(sk); |
@@ -323,7 +323,7 @@ void tcp_req_err(struct sock *sk, u32 seq) | |||
323 | 323 | ||
324 | if (seq != tcp_rsk(req)->snt_isn) { | 324 | if (seq != tcp_rsk(req)->snt_isn) { |
325 | NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS); | 325 | NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS); |
326 | } else { | 326 | } else if (abort) { |
327 | /* | 327 | /* |
328 | * Still in SYN_RECV, just remove it silently. | 328 | * Still in SYN_RECV, just remove it silently. |
329 | * There is no good way to pass the error to the newly | 329 | * There is no good way to pass the error to the newly |
@@ -383,7 +383,12 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) | |||
383 | } | 383 | } |
384 | seq = ntohl(th->seq); | 384 | seq = ntohl(th->seq); |
385 | if (sk->sk_state == TCP_NEW_SYN_RECV) | 385 | if (sk->sk_state == TCP_NEW_SYN_RECV) |
386 | return tcp_req_err(sk, seq); | 386 | return tcp_req_err(sk, seq, |
387 | type == ICMP_PARAMETERPROB || | ||
388 | type == ICMP_TIME_EXCEEDED || | ||
389 | (type == ICMP_DEST_UNREACH && | ||
390 | (code == ICMP_NET_UNREACH || | ||
391 | code == ICMP_HOST_UNREACH))); | ||
387 | 392 | ||
388 | bh_lock_sock(sk); | 393 | bh_lock_sock(sk); |
389 | /* If too many ICMPs get dropped on busy | 394 | /* If too many ICMPs get dropped on busy |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 38eeddedfc21..9efd9ffdc34c 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -3538,6 +3538,7 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp) | |||
3538 | { | 3538 | { |
3539 | struct inet6_dev *idev = ifp->idev; | 3539 | struct inet6_dev *idev = ifp->idev; |
3540 | struct net_device *dev = idev->dev; | 3540 | struct net_device *dev = idev->dev; |
3541 | bool notify = false; | ||
3541 | 3542 | ||
3542 | addrconf_join_solict(dev, &ifp->addr); | 3543 | addrconf_join_solict(dev, &ifp->addr); |
3543 | 3544 | ||
@@ -3583,7 +3584,7 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp) | |||
3583 | /* Because optimistic nodes can use this address, | 3584 | /* Because optimistic nodes can use this address, |
3584 | * notify listeners. If DAD fails, RTM_DELADDR is sent. | 3585 | * notify listeners. If DAD fails, RTM_DELADDR is sent. |
3585 | */ | 3586 | */ |
3586 | ipv6_ifa_notify(RTM_NEWADDR, ifp); | 3587 | notify = true; |
3587 | } | 3588 | } |
3588 | } | 3589 | } |
3589 | 3590 | ||
@@ -3591,6 +3592,8 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp) | |||
3591 | out: | 3592 | out: |
3592 | spin_unlock(&ifp->lock); | 3593 | spin_unlock(&ifp->lock); |
3593 | read_unlock_bh(&idev->lock); | 3594 | read_unlock_bh(&idev->lock); |
3595 | if (notify) | ||
3596 | ipv6_ifa_notify(RTM_NEWADDR, ifp); | ||
3594 | } | 3597 | } |
3595 | 3598 | ||
3596 | static void addrconf_dad_start(struct inet6_ifaddr *ifp) | 3599 | static void addrconf_dad_start(struct inet6_ifaddr *ifp) |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 1f9ebe3cbb4a..dc2db4f7b182 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -540,12 +540,13 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen) | |||
540 | } | 540 | } |
541 | spin_lock_bh(&ip6_sk_fl_lock); | 541 | spin_lock_bh(&ip6_sk_fl_lock); |
542 | for (sflp = &np->ipv6_fl_list; | 542 | for (sflp = &np->ipv6_fl_list; |
543 | (sfl = rcu_dereference(*sflp)) != NULL; | 543 | (sfl = rcu_dereference_protected(*sflp, |
544 | lockdep_is_held(&ip6_sk_fl_lock))) != NULL; | ||
544 | sflp = &sfl->next) { | 545 | sflp = &sfl->next) { |
545 | if (sfl->fl->label == freq.flr_label) { | 546 | if (sfl->fl->label == freq.flr_label) { |
546 | if (freq.flr_label == (np->flow_label&IPV6_FLOWLABEL_MASK)) | 547 | if (freq.flr_label == (np->flow_label&IPV6_FLOWLABEL_MASK)) |
547 | np->flow_label &= ~IPV6_FLOWLABEL_MASK; | 548 | np->flow_label &= ~IPV6_FLOWLABEL_MASK; |
548 | *sflp = rcu_dereference(sfl->next); | 549 | *sflp = sfl->next; |
549 | spin_unlock_bh(&ip6_sk_fl_lock); | 550 | spin_unlock_bh(&ip6_sk_fl_lock); |
550 | fl_release(sfl->fl); | 551 | fl_release(sfl->fl); |
551 | kfree_rcu(sfl, rcu); | 552 | kfree_rcu(sfl, rcu); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 006396e31cb0..1a5a70fb8551 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -327,6 +327,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
327 | struct tcp_sock *tp; | 327 | struct tcp_sock *tp; |
328 | __u32 seq, snd_una; | 328 | __u32 seq, snd_una; |
329 | struct sock *sk; | 329 | struct sock *sk; |
330 | bool fatal; | ||
330 | int err; | 331 | int err; |
331 | 332 | ||
332 | sk = __inet6_lookup_established(net, &tcp_hashinfo, | 333 | sk = __inet6_lookup_established(net, &tcp_hashinfo, |
@@ -345,8 +346,9 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
345 | return; | 346 | return; |
346 | } | 347 | } |
347 | seq = ntohl(th->seq); | 348 | seq = ntohl(th->seq); |
349 | fatal = icmpv6_err_convert(type, code, &err); | ||
348 | if (sk->sk_state == TCP_NEW_SYN_RECV) | 350 | if (sk->sk_state == TCP_NEW_SYN_RECV) |
349 | return tcp_req_err(sk, seq); | 351 | return tcp_req_err(sk, seq, fatal); |
350 | 352 | ||
351 | bh_lock_sock(sk); | 353 | bh_lock_sock(sk); |
352 | if (sock_owned_by_user(sk) && type != ICMPV6_PKT_TOOBIG) | 354 | if (sock_owned_by_user(sk) && type != ICMPV6_PKT_TOOBIG) |
@@ -400,7 +402,6 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
400 | goto out; | 402 | goto out; |
401 | } | 403 | } |
402 | 404 | ||
403 | icmpv6_err_convert(type, code, &err); | ||
404 | 405 | ||
405 | /* Might be for an request_sock */ | 406 | /* Might be for an request_sock */ |
406 | switch (sk->sk_state) { | 407 | switch (sk->sk_state) { |
diff --git a/net/openvswitch/vport-vxlan.c b/net/openvswitch/vport-vxlan.c index 1605691d9414..de9cb19efb6a 100644 --- a/net/openvswitch/vport-vxlan.c +++ b/net/openvswitch/vport-vxlan.c | |||
@@ -91,6 +91,8 @@ static struct vport *vxlan_tnl_create(const struct vport_parms *parms) | |||
91 | struct vxlan_config conf = { | 91 | struct vxlan_config conf = { |
92 | .no_share = true, | 92 | .no_share = true, |
93 | .flags = VXLAN_F_COLLECT_METADATA, | 93 | .flags = VXLAN_F_COLLECT_METADATA, |
94 | /* Don't restrict the packets that can be sent by MTU */ | ||
95 | .mtu = IP_MAX_MTU, | ||
94 | }; | 96 | }; |
95 | 97 | ||
96 | if (!options) { | 98 | if (!options) { |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 5ca2ebfe0be8..e878da0949db 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -5538,6 +5538,7 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, | |||
5538 | struct sctp_hmac_algo_param *hmacs; | 5538 | struct sctp_hmac_algo_param *hmacs; |
5539 | __u16 data_len = 0; | 5539 | __u16 data_len = 0; |
5540 | u32 num_idents; | 5540 | u32 num_idents; |
5541 | int i; | ||
5541 | 5542 | ||
5542 | if (!ep->auth_enable) | 5543 | if (!ep->auth_enable) |
5543 | return -EACCES; | 5544 | return -EACCES; |
@@ -5555,8 +5556,12 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, | |||
5555 | return -EFAULT; | 5556 | return -EFAULT; |
5556 | if (put_user(num_idents, &p->shmac_num_idents)) | 5557 | if (put_user(num_idents, &p->shmac_num_idents)) |
5557 | return -EFAULT; | 5558 | return -EFAULT; |
5558 | if (copy_to_user(p->shmac_idents, hmacs->hmac_ids, data_len)) | 5559 | for (i = 0; i < num_idents; i++) { |
5559 | return -EFAULT; | 5560 | __u16 hmacid = ntohs(hmacs->hmac_ids[i]); |
5561 | |||
5562 | if (copy_to_user(&p->shmac_idents[i], &hmacid, sizeof(__u16))) | ||
5563 | return -EFAULT; | ||
5564 | } | ||
5560 | return 0; | 5565 | return 0; |
5561 | } | 5566 | } |
5562 | 5567 | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 49d5093eb055..29be035f9c65 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1496,7 +1496,7 @@ static void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb) | |||
1496 | UNIXCB(skb).fp = NULL; | 1496 | UNIXCB(skb).fp = NULL; |
1497 | 1497 | ||
1498 | for (i = scm->fp->count-1; i >= 0; i--) | 1498 | for (i = scm->fp->count-1; i >= 0; i--) |
1499 | unix_notinflight(scm->fp->fp[i]); | 1499 | unix_notinflight(scm->fp->user, scm->fp->fp[i]); |
1500 | } | 1500 | } |
1501 | 1501 | ||
1502 | static void unix_destruct_scm(struct sk_buff *skb) | 1502 | static void unix_destruct_scm(struct sk_buff *skb) |
@@ -1561,7 +1561,7 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) | |||
1561 | return -ENOMEM; | 1561 | return -ENOMEM; |
1562 | 1562 | ||
1563 | for (i = scm->fp->count - 1; i >= 0; i--) | 1563 | for (i = scm->fp->count - 1; i >= 0; i--) |
1564 | unix_inflight(scm->fp->fp[i]); | 1564 | unix_inflight(scm->fp->user, scm->fp->fp[i]); |
1565 | return max_level; | 1565 | return max_level; |
1566 | } | 1566 | } |
1567 | 1567 | ||
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 8fcdc2283af5..6a0d48525fcf 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -116,7 +116,7 @@ struct sock *unix_get_socket(struct file *filp) | |||
116 | * descriptor if it is for an AF_UNIX socket. | 116 | * descriptor if it is for an AF_UNIX socket. |
117 | */ | 117 | */ |
118 | 118 | ||
119 | void unix_inflight(struct file *fp) | 119 | void unix_inflight(struct user_struct *user, struct file *fp) |
120 | { | 120 | { |
121 | struct sock *s = unix_get_socket(fp); | 121 | struct sock *s = unix_get_socket(fp); |
122 | 122 | ||
@@ -133,11 +133,11 @@ void unix_inflight(struct file *fp) | |||
133 | } | 133 | } |
134 | unix_tot_inflight++; | 134 | unix_tot_inflight++; |
135 | } | 135 | } |
136 | fp->f_cred->user->unix_inflight++; | 136 | user->unix_inflight++; |
137 | spin_unlock(&unix_gc_lock); | 137 | spin_unlock(&unix_gc_lock); |
138 | } | 138 | } |
139 | 139 | ||
140 | void unix_notinflight(struct file *fp) | 140 | void unix_notinflight(struct user_struct *user, struct file *fp) |
141 | { | 141 | { |
142 | struct sock *s = unix_get_socket(fp); | 142 | struct sock *s = unix_get_socket(fp); |
143 | 143 | ||
@@ -152,7 +152,7 @@ void unix_notinflight(struct file *fp) | |||
152 | list_del_init(&u->link); | 152 | list_del_init(&u->link); |
153 | unix_tot_inflight--; | 153 | unix_tot_inflight--; |
154 | } | 154 | } |
155 | fp->f_cred->user->unix_inflight--; | 155 | user->unix_inflight--; |
156 | spin_unlock(&unix_gc_lock); | 156 | spin_unlock(&unix_gc_lock); |
157 | } | 157 | } |
158 | 158 | ||