diff options
Diffstat (limited to 'net/sctp/ipv6.c')
-rw-r--r-- | net/sctp/ipv6.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index bb280e60e00a..9fb5d37c37ad 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/netdevice.h> | 58 | #include <linux/netdevice.h> |
59 | #include <linux/init.h> | 59 | #include <linux/init.h> |
60 | #include <linux/ipsec.h> | 60 | #include <linux/ipsec.h> |
61 | #include <linux/slab.h> | ||
61 | 62 | ||
62 | #include <linux/ipv6.h> | 63 | #include <linux/ipv6.h> |
63 | #include <linux/icmpv6.h> | 64 | #include <linux/icmpv6.h> |
@@ -381,7 +382,6 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist, | |||
381 | addr->a.v6.sin6_scope_id = dev->ifindex; | 382 | addr->a.v6.sin6_scope_id = dev->ifindex; |
382 | addr->valid = 1; | 383 | addr->valid = 1; |
383 | INIT_LIST_HEAD(&addr->list); | 384 | INIT_LIST_HEAD(&addr->list); |
384 | INIT_RCU_HEAD(&addr->rcu); | ||
385 | list_add_tail(&addr->list, addrlist); | 385 | list_add_tail(&addr->list, addrlist); |
386 | } | 386 | } |
387 | } | 387 | } |
@@ -837,15 +837,16 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr) | |||
837 | if (type & IPV6_ADDR_LINKLOCAL) { | 837 | if (type & IPV6_ADDR_LINKLOCAL) { |
838 | if (!addr->v6.sin6_scope_id) | 838 | if (!addr->v6.sin6_scope_id) |
839 | return 0; | 839 | return 0; |
840 | dev = dev_get_by_index(&init_net, addr->v6.sin6_scope_id); | 840 | rcu_read_lock(); |
841 | if (!dev) | 841 | dev = dev_get_by_index_rcu(&init_net, |
842 | return 0; | 842 | addr->v6.sin6_scope_id); |
843 | if (!ipv6_chk_addr(&init_net, &addr->v6.sin6_addr, | 843 | if (!dev || |
844 | !ipv6_chk_addr(&init_net, &addr->v6.sin6_addr, | ||
844 | dev, 0)) { | 845 | dev, 0)) { |
845 | dev_put(dev); | 846 | rcu_read_unlock(); |
846 | return 0; | 847 | return 0; |
847 | } | 848 | } |
848 | dev_put(dev); | 849 | rcu_read_unlock(); |
849 | } else if (type == IPV6_ADDR_MAPPED) { | 850 | } else if (type == IPV6_ADDR_MAPPED) { |
850 | if (!opt->v4mapped) | 851 | if (!opt->v4mapped) |
851 | return 0; | 852 | return 0; |
@@ -873,10 +874,12 @@ static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr) | |||
873 | if (type & IPV6_ADDR_LINKLOCAL) { | 874 | if (type & IPV6_ADDR_LINKLOCAL) { |
874 | if (!addr->v6.sin6_scope_id) | 875 | if (!addr->v6.sin6_scope_id) |
875 | return 0; | 876 | return 0; |
876 | dev = dev_get_by_index(&init_net, addr->v6.sin6_scope_id); | 877 | rcu_read_lock(); |
878 | dev = dev_get_by_index_rcu(&init_net, | ||
879 | addr->v6.sin6_scope_id); | ||
880 | rcu_read_unlock(); | ||
877 | if (!dev) | 881 | if (!dev) |
878 | return 0; | 882 | return 0; |
879 | dev_put(dev); | ||
880 | } | 883 | } |
881 | af = opt->pf->af; | 884 | af = opt->pf->af; |
882 | } | 885 | } |
@@ -930,7 +933,6 @@ static struct inet_protosw sctpv6_seqpacket_protosw = { | |||
930 | .protocol = IPPROTO_SCTP, | 933 | .protocol = IPPROTO_SCTP, |
931 | .prot = &sctpv6_prot, | 934 | .prot = &sctpv6_prot, |
932 | .ops = &inet6_seqpacket_ops, | 935 | .ops = &inet6_seqpacket_ops, |
933 | .capability = -1, | ||
934 | .no_check = 0, | 936 | .no_check = 0, |
935 | .flags = SCTP_PROTOSW_FLAG | 937 | .flags = SCTP_PROTOSW_FLAG |
936 | }; | 938 | }; |
@@ -939,7 +941,6 @@ static struct inet_protosw sctpv6_stream_protosw = { | |||
939 | .protocol = IPPROTO_SCTP, | 941 | .protocol = IPPROTO_SCTP, |
940 | .prot = &sctpv6_prot, | 942 | .prot = &sctpv6_prot, |
941 | .ops = &inet6_seqpacket_ops, | 943 | .ops = &inet6_seqpacket_ops, |
942 | .capability = -1, | ||
943 | .no_check = 0, | 944 | .no_check = 0, |
944 | .flags = SCTP_PROTOSW_FLAG, | 945 | .flags = SCTP_PROTOSW_FLAG, |
945 | }; | 946 | }; |