mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
X25: Fix x25_create errors for bad protocol and ENOBUFS
alloc_socket failures should return -ENOBUFS a bad protocol should return -EINVAL Signed-off-by: Andrew Hendry <andrew.hendry@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cf588477a3
commit
b18e7a0685
@ -512,15 +512,20 @@ static int x25_create(struct net *net, struct socket *sock, int protocol,
|
||||
{
|
||||
struct sock *sk;
|
||||
struct x25_sock *x25;
|
||||
int rc = -ESOCKTNOSUPPORT;
|
||||
int rc = -EAFNOSUPPORT;
|
||||
|
||||
if (!net_eq(net, &init_net))
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
if (sock->type != SOCK_SEQPACKET || protocol)
|
||||
goto out;
|
||||
|
||||
rc = -ENOMEM;
|
||||
rc = -ESOCKTNOSUPPORT;
|
||||
if (sock->type != SOCK_SEQPACKET)
|
||||
goto out;
|
||||
|
||||
rc = -EINVAL;
|
||||
if (protocol)
|
||||
goto out;
|
||||
|
||||
rc = -ENOBUFS;
|
||||
if ((sk = x25_alloc_socket(net)) == NULL)
|
||||
goto out;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user