Skip to content

Commit

Permalink
X25: Fix x25_create errors for bad protocol and ENOBUFS
Browse files Browse the repository at this point in the history
alloc_socket failures should return -ENOBUFS
a bad protocol should return -EINVAL

Signed-off-by: Andrew Hendry <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
AndrewHendry authored and davem330 committed Feb 16, 2010
1 parent cf58847 commit b18e7a0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions net/x25/af_x25.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
goto out;

rc = -ESOCKTNOSUPPORT;
if (sock->type != SOCK_SEQPACKET)
goto out;

if (sock->type != SOCK_SEQPACKET || protocol)
rc = -EINVAL;
if (protocol)
goto out;

rc = -ENOMEM;
rc = -ENOBUFS;
if ((sk = x25_alloc_socket(net)) == NULL)
goto out;

Expand Down

0 comments on commit b18e7a0

Please sign in to comment.