diff options
author | andrew hendry <andrew.hendry@gmail.com> | 2010-02-13 21:00:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-16 00:49:51 -0500 |
commit | b18e7a06857833d2c7c8c8457e5a3a7c3327f643 (patch) | |
tree | abf2e7f6705e6043815edecd6d8fc0cec4c582f5 | |
parent | cf588477a3fbf085426e5c0b6205984ebb7e2187 (diff) |
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>
-rw-r--r-- | net/x25/af_x25.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index e3219e4cd044..6c7104edec60 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -512,15 +512,20 @@ static int x25_create(struct net *net, struct socket *sock, int protocol, | |||
512 | { | 512 | { |
513 | struct sock *sk; | 513 | struct sock *sk; |
514 | struct x25_sock *x25; | 514 | struct x25_sock *x25; |
515 | int rc = -ESOCKTNOSUPPORT; | 515 | int rc = -EAFNOSUPPORT; |
516 | 516 | ||
517 | if (!net_eq(net, &init_net)) | 517 | if (!net_eq(net, &init_net)) |
518 | return -EAFNOSUPPORT; | 518 | goto out; |
519 | |||
520 | rc = -ESOCKTNOSUPPORT; | ||
521 | if (sock->type != SOCK_SEQPACKET) | ||
522 | goto out; | ||
519 | 523 | ||
520 | if (sock->type != SOCK_SEQPACKET || protocol) | 524 | rc = -EINVAL; |
525 | if (protocol) | ||
521 | goto out; | 526 | goto out; |
522 | 527 | ||
523 | rc = -ENOMEM; | 528 | rc = -ENOBUFS; |
524 | if ((sk = x25_alloc_socket(net)) == NULL) | 529 | if ((sk = x25_alloc_socket(net)) == NULL) |
525 | goto out; | 530 | goto out; |
526 | 531 | ||