summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMartin Schiller <ms@dev.tdt.de>2018-11-27 09:50:28 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-13 08:52:15 +0100
commitd094d6510231b1ebafe6cc651507a62206f0ca72 (patch)
treeac5fabf80d1d9950a95b40c832727a7db79d359c /net
parent12fc4bcc89ef5b34a8fdd8df6b674e055be09a17 (diff)
downloadlinux-stable-d094d6510231b1ebafe6cc651507a62206f0ca72.tar.gz
linux-stable-d094d6510231b1ebafe6cc651507a62206f0ca72.tar.bz2
linux-stable-d094d6510231b1ebafe6cc651507a62206f0ca72.zip
net/x25: fix null_x25_address handling
[ Upstream commit 06137619f061f498c2924f6543fa45b7d39f0501 ] o x25_find_listener(): the compare for the null_x25_address was wrong. We have to check the x25_addr of the listener socket instead of the x25_addr of the incomming call. o x25_bind(): it was not possible to bind a socket to null_x25_address Signed-off-by: Martin Schiller <ms@dev.tdt.de> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/x25/af_x25.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 3150648206b6..20a511398389 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -288,7 +288,7 @@ static struct sock *x25_find_listener(struct x25_address *addr,
sk_for_each(s, &x25_list)
if ((!strcmp(addr->x25_addr,
x25_sk(s)->source_addr.x25_addr) ||
- !strcmp(addr->x25_addr,
+ !strcmp(x25_sk(s)->source_addr.x25_addr,
null_x25_address.x25_addr)) &&
s->sk_state == TCP_LISTEN) {
/*
@@ -685,11 +685,15 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
goto out;
}
- len = strlen(addr->sx25_addr.x25_addr);
- for (i = 0; i < len; i++) {
- if (!isdigit(addr->sx25_addr.x25_addr[i])) {
- rc = -EINVAL;
- goto out;
+ /* check for the null_x25_address */
+ if (strcmp(addr->sx25_addr.x25_addr, null_x25_address.x25_addr)) {
+
+ len = strlen(addr->sx25_addr.x25_addr);
+ for (i = 0; i < len; i++) {
+ if (!isdigit(addr->sx25_addr.x25_addr[i])) {
+ rc = -EINVAL;
+ goto out;
+ }
}
}