diff options
Diffstat (limited to 'net/ipv6/af_inet6.c')
-rw-r--r-- | net/ipv6/af_inet6.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index a75c4bc9281a..53b06de696bd 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -565,21 +565,23 @@ static struct inet_protosw rawv6_protosw = { | |||
565 | .flags = INET_PROTOSW_REUSE, | 565 | .flags = INET_PROTOSW_REUSE, |
566 | }; | 566 | }; |
567 | 567 | ||
568 | void | 568 | int inet6_register_protosw(struct inet_protosw *p) |
569 | inet6_register_protosw(struct inet_protosw *p) | ||
570 | { | 569 | { |
571 | struct list_head *lh; | 570 | struct list_head *lh; |
572 | struct inet_protosw *answer; | 571 | struct inet_protosw *answer; |
573 | int protocol = p->protocol; | ||
574 | struct list_head *last_perm; | 572 | struct list_head *last_perm; |
573 | int protocol = p->protocol; | ||
574 | int ret; | ||
575 | 575 | ||
576 | spin_lock_bh(&inetsw6_lock); | 576 | spin_lock_bh(&inetsw6_lock); |
577 | 577 | ||
578 | ret = -EINVAL; | ||
578 | if (p->type >= SOCK_MAX) | 579 | if (p->type >= SOCK_MAX) |
579 | goto out_illegal; | 580 | goto out_illegal; |
580 | 581 | ||
581 | /* If we are trying to override a permanent protocol, bail. */ | 582 | /* If we are trying to override a permanent protocol, bail. */ |
582 | answer = NULL; | 583 | answer = NULL; |
584 | ret = -EPERM; | ||
583 | last_perm = &inetsw6[p->type]; | 585 | last_perm = &inetsw6[p->type]; |
584 | list_for_each(lh, &inetsw6[p->type]) { | 586 | list_for_each(lh, &inetsw6[p->type]) { |
585 | answer = list_entry(lh, struct inet_protosw, list); | 587 | answer = list_entry(lh, struct inet_protosw, list); |
@@ -603,9 +605,10 @@ inet6_register_protosw(struct inet_protosw *p) | |||
603 | * system automatically returns to the old behavior. | 605 | * system automatically returns to the old behavior. |
604 | */ | 606 | */ |
605 | list_add_rcu(&p->list, last_perm); | 607 | list_add_rcu(&p->list, last_perm); |
608 | ret = 0; | ||
606 | out: | 609 | out: |
607 | spin_unlock_bh(&inetsw6_lock); | 610 | spin_unlock_bh(&inetsw6_lock); |
608 | return; | 611 | return ret; |
609 | 612 | ||
610 | out_permanent: | 613 | out_permanent: |
611 | printk(KERN_ERR "Attempt to override permanent protocol %d.\n", | 614 | printk(KERN_ERR "Attempt to override permanent protocol %d.\n", |