aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2006-06-25 23:47:18 -0700
committerDavid S. Miller <davem@davemloft.net>2006-06-25 23:47:18 -0700
commit499786516fc12791223f075d682a45ea1129eb04 (patch)
tree7c1e2b25687eae5c41d8a24b34e6bb4190d969e8 /net/tipc/socket.c
parent1303e8f173a8a5000ee6e2fba876fec9474ed1f6 (diff)
downloadkernel_goldelico_gta04-499786516fc12791223f075d682a45ea1129eb04.zip
kernel_goldelico_gta04-499786516fc12791223f075d682a45ea1129eb04.tar.gz
kernel_goldelico_gta04-499786516fc12791223f075d682a45ea1129eb04.tar.bz2
[TIPC]: Improved performance of error checking during socket creation.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Per Liden <per.liden@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 8cefacb..a1f2210 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -169,12 +169,6 @@ static int tipc_create(struct socket *sock, int protocol)
struct sock *sk;
u32 ref;
- if ((sock->type != SOCK_STREAM) &&
- (sock->type != SOCK_SEQPACKET) &&
- (sock->type != SOCK_DGRAM) &&
- (sock->type != SOCK_RDM))
- return -EPROTOTYPE;
-
if (unlikely(protocol != 0))
return -EPROTONOSUPPORT;
@@ -199,6 +193,9 @@ static int tipc_create(struct socket *sock, int protocol)
sock->ops = &msg_ops;
sock->state = SS_READY;
break;
+ default:
+ tipc_deleteport(ref);
+ return -EPROTOTYPE;
}
sk = sk_alloc(AF_TIPC, GFP_KERNEL, &tipc_proto, 1);