diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2011-11-02 15:49:40 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-02-24 17:05:14 -0500 |
commit | c422f1bdc3d3f9f637b3d288a6601668e26111d6 (patch) | |
tree | d3e810de3eb96a19afb65c6605af5e00620e3316 /net/tipc/socket.c | |
parent | c74a46110fd5f97bf9299e68e9ed0453bdacb181 (diff) |
tipc: Simplify enforcement of reserved name type prohibition
Streamlines the logic that prevents an application from binding a
reserved TIPC name type to a port by moving the check to the code
that handles a socket bind() operation. This allows internal TIPC
subsystems to bind a reserved name without having to set an atomic
flag to gain permission to use such a name. (This simplification is
now possible due to the elimination of support for TIPC's native API.)
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index e2f7c5d370ba..d3227f2a216e 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -355,6 +355,9 @@ static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len) | |||
355 | else if (addr->addrtype != TIPC_ADDR_NAMESEQ) | 355 | else if (addr->addrtype != TIPC_ADDR_NAMESEQ) |
356 | return -EAFNOSUPPORT; | 356 | return -EAFNOSUPPORT; |
357 | 357 | ||
358 | if (addr->addr.nameseq.type < TIPC_RESERVED_TYPES) | ||
359 | return -EACCES; | ||
360 | |||
358 | return (addr->scope > 0) ? | 361 | return (addr->scope > 0) ? |
359 | tipc_publish(portref, addr->scope, &addr->addr.nameseq) : | 362 | tipc_publish(portref, addr->scope, &addr->addr.nameseq) : |
360 | tipc_withdraw(portref, -addr->scope, &addr->addr.nameseq); | 363 | tipc_withdraw(portref, -addr->scope, &addr->addr.nameseq); |