[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>
This commit is contained in:
parent
1303e8f173
commit
499786516f
1 changed files with 3 additions and 6 deletions
|
@ -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)
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue