diff options
author | andrew hendry <andrew.hendry@gmail.com> | 2010-02-14 03:00:11 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-16 06:49:51 +0100 |
commit | b18e7a06857833d2c7c8c8457e5a3a7c3327f643 (patch) | |
tree | abf2e7f6705e6043815edecd6d8fc0cec4c582f5 /net/x25/af_x25.c | |
parent | be2net: implement EEH pci error recovery handlers (diff) | |
download | linux-b18e7a06857833d2c7c8c8457e5a3a7c3327f643.tar.xz linux-b18e7a06857833d2c7c8c8457e5a3a7c3327f643.zip |
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>
Diffstat (limited to 'net/x25/af_x25.c')
-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, { 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; |