X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=net%2Fsctp%2Fipv6.c;h=8765177be8fb723c88c99a446807e4c21f12eb86;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=09e6df2084727b60f84dcff8ced5f40f76aadffa;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 09e6df208..8765177be 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c @@ -583,8 +583,8 @@ struct sock *sctp_v6_create_accept_sk(struct sock *sk, struct ipv6_pinfo *newnp, *np = inet6_sk(sk); struct sctp6_sock *newsctp6sk; - newsk = sk_alloc(PF_INET6, GFP_KERNEL, sizeof(struct sctp6_sock), - sk->sk_slab); + newsk = sk_alloc(PF_INET6, GFP_KERNEL, sk->sk_prot->slab_obj_size, + sk->sk_prot->slab); if (!newsk) goto out; @@ -892,7 +892,7 @@ static struct proto_ops inet6_seqpacket_ops = { static struct inet_protosw sctpv6_seqpacket_protosw = { .type = SOCK_SEQPACKET, .protocol = IPPROTO_SCTP, - .prot = &sctp_prot, + .prot = &sctpv6_prot, .ops = &inet6_seqpacket_ops, .capability = -1, .no_check = 0, @@ -901,7 +901,7 @@ static struct inet_protosw sctpv6_seqpacket_protosw = { static struct inet_protosw sctpv6_stream_protosw = { .type = SOCK_STREAM, .protocol = IPPROTO_SCTP, - .prot = &sctp_prot, + .prot = &sctpv6_prot, .ops = &inet6_seqpacket_ops, .capability = -1, .no_check = 0, @@ -963,9 +963,14 @@ static struct sctp_pf sctp_pf_inet6_specific = { /* Initialize IPv6 support and register with inet6 stack. */ int sctp_v6_init(void) { + int rc = sk_alloc_slab(&sctpv6_prot, "sctpv6_sock"); + + if (rc) + goto out; /* Register inet6 protocol. */ + rc = -EAGAIN; if (inet6_add_protocol(&sctpv6_protocol, IPPROTO_SCTP) < 0) - return -EAGAIN; + goto out_sctp_free_slab; /* Add SCTPv6(UDP and TCP style) to inetsw6 linked list. */ inet6_register_protosw(&sctpv6_seqpacket_protosw); @@ -979,8 +984,12 @@ int sctp_v6_init(void) /* Register notifier for inet6 address additions/deletions. */ register_inet6addr_notifier(&sctp_inetaddr_notifier); - - return 0; + rc = 0; +out: + return rc; +out_sctp_free_slab: + sk_free_slab(&sctpv6_prot); + goto out; } /* IPv6 specific exit support. */ @@ -991,4 +1000,5 @@ void sctp_v6_exit(void) inet6_unregister_protosw(&sctpv6_seqpacket_protosw); inet6_unregister_protosw(&sctpv6_stream_protosw); unregister_inet6addr_notifier(&sctp_inetaddr_notifier); + sk_free_slab(&sctpv6_prot); }