Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78394
b: refs/heads/master
c: 87c3efb
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Lezcano authored and David S. Miller committed Jan 28, 2008
1 parent 7bc2201 commit b41ea74
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 853cbbaaa4ccdf221be5ab6afe967aa9998546b7
refs/heads/master: 87c3efbfdd1f98af14a1f60ff19f73d9a8d8da98
2 changes: 1 addition & 1 deletion trunk/include/net/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extern void inet_unregister_protosw(struct inet_protosw *p);
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
extern int inet6_add_protocol(struct inet6_protocol *prot, unsigned char num);
extern int inet6_del_protocol(struct inet6_protocol *prot, unsigned char num);
extern void inet6_register_protosw(struct inet_protosw *p);
extern int inet6_register_protosw(struct inet_protosw *p);
extern void inet6_unregister_protosw(struct inet_protosw *p);
#endif

Expand Down
11 changes: 7 additions & 4 deletions trunk/net/ipv6/af_inet6.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,21 +565,23 @@ static struct inet_protosw rawv6_protosw = {
.flags = INET_PROTOSW_REUSE,
};

void
inet6_register_protosw(struct inet_protosw *p)
int inet6_register_protosw(struct inet_protosw *p)
{
struct list_head *lh;
struct inet_protosw *answer;
int protocol = p->protocol;
struct list_head *last_perm;
int protocol = p->protocol;
int ret;

spin_lock_bh(&inetsw6_lock);

ret = -EINVAL;
if (p->type >= SOCK_MAX)
goto out_illegal;

/* If we are trying to override a permanent protocol, bail. */
answer = NULL;
ret = -EPERM;
last_perm = &inetsw6[p->type];
list_for_each(lh, &inetsw6[p->type]) {
answer = list_entry(lh, struct inet_protosw, list);
Expand All @@ -603,9 +605,10 @@ inet6_register_protosw(struct inet_protosw *p)
* system automatically returns to the old behavior.
*/
list_add_rcu(&p->list, last_perm);
ret = 0;
out:
spin_unlock_bh(&inetsw6_lock);
return;
return ret;

out_permanent:
printk(KERN_ERR "Attempt to override permanent protocol %d.\n",
Expand Down

0 comments on commit b41ea74

Please sign in to comment.