X25: Fix x25_create errors for bad protocol and ENOBUFS
Subsystems (3)
PATCH 1/2 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 <[email protected]>
---
net/x25/af_x25.c +9 -4
@@ -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;
Signature · 1 line
1.6.3.3
From: Andrew Hendry <[email protected]>
Date: Sun, 14 Feb 2010 23:00:11 +1100
Quoted 4 lines
alloc_socketfailures should return-ENOBUFS
a bad protocol should return-EINVALSigned-off-by Andrew Hendry <[email protected]>
Applied.