提交 b18e7a06 编写于 作者: A andrew hendry 提交者: David S. Miller

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: NAndrew Hendry <andrew.hendry@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 cf588477
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册