]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - net/sctp/ipv6.c
Merge branch 'tip/tracing/core3' of git://git.kernel.org/pub/scm/linux/kernel/git...
[mv-sheeva.git] / net / sctp / ipv6.c
index 6a4b19094143653ab79a43de52d916fd8ed2a0f0..cc50fbe992913a7444b934c488dccab231783a14 100644 (file)
@@ -837,15 +837,16 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr)
                if (type & IPV6_ADDR_LINKLOCAL) {
                        if (!addr->v6.sin6_scope_id)
                                return 0;
-                       dev = dev_get_by_index(&init_net, addr->v6.sin6_scope_id);
-                       if (!dev)
-                               return 0;
-                       if (!ipv6_chk_addr(&init_net, &addr->v6.sin6_addr,
+                       rcu_read_lock();
+                       dev = dev_get_by_index_rcu(&init_net,
+                                                  addr->v6.sin6_scope_id);
+                       if (!dev ||
+                           !ipv6_chk_addr(&init_net, &addr->v6.sin6_addr,
                                           dev, 0)) {
-                               dev_put(dev);
+                               rcu_read_unlock();
                                return 0;
                        }
-                       dev_put(dev);
+                       rcu_read_unlock();
                } else if (type == IPV6_ADDR_MAPPED) {
                        if (!opt->v4mapped)
                                return 0;
@@ -873,10 +874,12 @@ static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr)
                if (type & IPV6_ADDR_LINKLOCAL) {
                        if (!addr->v6.sin6_scope_id)
                                return 0;
-                       dev = dev_get_by_index(&init_net, addr->v6.sin6_scope_id);
+                       rcu_read_lock();
+                       dev = dev_get_by_index_rcu(&init_net,
+                                                  addr->v6.sin6_scope_id);
+                       rcu_read_unlock();
                        if (!dev)
                                return 0;
-                       dev_put(dev);
                }
                af = opt->pf->af;
        }
@@ -930,7 +933,6 @@ static struct inet_protosw sctpv6_seqpacket_protosw = {
        .protocol      = IPPROTO_SCTP,
        .prot          = &sctpv6_prot,
        .ops           = &inet6_seqpacket_ops,
-       .capability    = -1,
        .no_check      = 0,
        .flags         = SCTP_PROTOSW_FLAG
 };
@@ -939,7 +941,6 @@ static struct inet_protosw sctpv6_stream_protosw = {
        .protocol      = IPPROTO_SCTP,
        .prot          = &sctpv6_prot,
        .ops           = &inet6_seqpacket_ops,
-       .capability    = -1,
        .no_check      = 0,
        .flags         = SCTP_PROTOSW_FLAG,
 };
@@ -949,7 +950,7 @@ static int sctp6_rcv(struct sk_buff *skb)
        return sctp_rcv(skb) ? -1 : 0;
 }
 
-static struct inet6_protocol sctpv6_protocol = {
+static const struct inet6_protocol sctpv6_protocol = {
        .handler      = sctp6_rcv,
        .err_handler  = sctp_v6_err,
        .flags        = INET6_PROTO_NOPOLICY | INET6_PROTO_FINAL,