Commit 49978651 authored by Allan Stephens's avatar Allan Stephens Committed by David S. Miller

[TIPC]: Improved performance of error checking during socket creation.

Signed-off-by: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarPer Liden <per.liden@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1303e8f1
...@@ -169,12 +169,6 @@ static int tipc_create(struct socket *sock, int protocol) ...@@ -169,12 +169,6 @@ static int tipc_create(struct socket *sock, int protocol)
struct sock *sk; struct sock *sk;
u32 ref; 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)) if (unlikely(protocol != 0))
return -EPROTONOSUPPORT; return -EPROTONOSUPPORT;
...@@ -199,6 +193,9 @@ static int tipc_create(struct socket *sock, int protocol) ...@@ -199,6 +193,9 @@ static int tipc_create(struct socket *sock, int protocol)
sock->ops = &msg_ops; sock->ops = &msg_ops;
sock->state = SS_READY; sock->state = SS_READY;
break; break;
default:
tipc_deleteport(ref);
return -EPROTOTYPE;
} }
sk = sk_alloc(AF_TIPC, GFP_KERNEL, &tipc_proto, 1); sk = sk_alloc(AF_TIPC, GFP_KERNEL, &tipc_proto, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment