diff options
Diffstat (limited to 'net/tipc/bearer.c')
-rw-r--r-- | net/tipc/bearer.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 3dd19fdc5a2c..02b6cf6ab7a4 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
@@ -119,7 +119,8 @@ int tipc_register_media(u32 media_type, | |||
119 | warn("Media registration error: no broadcast address supplied\n"); | 119 | warn("Media registration error: no broadcast address supplied\n"); |
120 | goto exit; | 120 | goto exit; |
121 | } | 121 | } |
122 | if (bearer_priority >= TIPC_NUM_LINK_PRI) { | 122 | if ((bearer_priority < TIPC_MIN_LINK_PRI) && |
123 | (bearer_priority > TIPC_MAX_LINK_PRI)) { | ||
123 | warn("Media registration error: priority %u\n", bearer_priority); | 124 | warn("Media registration error: priority %u\n", bearer_priority); |
124 | goto exit; | 125 | goto exit; |
125 | } | 126 | } |
@@ -476,10 +477,15 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) | |||
476 | 477 | ||
477 | if (tipc_mode != TIPC_NET_MODE) | 478 | if (tipc_mode != TIPC_NET_MODE) |
478 | return -ENOPROTOOPT; | 479 | return -ENOPROTOOPT; |
480 | |||
479 | if (!bearer_name_validate(name, &b_name) || | 481 | if (!bearer_name_validate(name, &b_name) || |
480 | !addr_domain_valid(bcast_scope) || | 482 | !addr_domain_valid(bcast_scope) || |
481 | !in_scope(bcast_scope, tipc_own_addr) || | 483 | !in_scope(bcast_scope, tipc_own_addr)) |
482 | (priority > TIPC_NUM_LINK_PRI)) | 484 | return -EINVAL; |
485 | |||
486 | if ((priority < TIPC_MIN_LINK_PRI || | ||
487 | priority > TIPC_MAX_LINK_PRI) && | ||
488 | (priority != TIPC_MEDIA_LINK_PRI)) | ||
483 | return -EINVAL; | 489 | return -EINVAL; |
484 | 490 | ||
485 | write_lock_bh(&net_lock); | 491 | write_lock_bh(&net_lock); |
@@ -491,7 +497,8 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) | |||
491 | warn("No media <%s>\n", b_name.media_name); | 497 | warn("No media <%s>\n", b_name.media_name); |
492 | goto failed; | 498 | goto failed; |
493 | } | 499 | } |
494 | if (priority == TIPC_NUM_LINK_PRI) | 500 | |
501 | if (priority == TIPC_MEDIA_LINK_PRI) | ||
495 | priority = m_ptr->priority; | 502 | priority = m_ptr->priority; |
496 | 503 | ||
497 | restart: | 504 | restart: |
@@ -547,8 +554,8 @@ restart: | |||
547 | } | 554 | } |
548 | b_ptr->publ.lock = SPIN_LOCK_UNLOCKED; | 555 | b_ptr->publ.lock = SPIN_LOCK_UNLOCKED; |
549 | write_unlock_bh(&net_lock); | 556 | write_unlock_bh(&net_lock); |
550 | info("Enabled bearer <%s>, discovery domain %s\n", | 557 | info("Enabled bearer <%s>, discovery domain %s, priority %u\n", |
551 | name, addr_string_fill(addr_string, bcast_scope)); | 558 | name, addr_string_fill(addr_string, bcast_scope), priority); |
552 | return 0; | 559 | return 0; |
553 | failed: | 560 | failed: |
554 | write_unlock_bh(&net_lock); | 561 | write_unlock_bh(&net_lock); |