diff options
author | Martin Schiller <ms@dev.tdt.de> | 2018-11-27 03:50:28 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-11-29 17:25:36 -0500 |
commit | 06137619f061f498c2924f6543fa45b7d39f0501 (patch) | |
tree | a7d0c8beda7aad18a7e720f6c03d397f185b29d0 | |
parent | d449ba3d581ed29f751a59792fdc775572c66904 (diff) |
net/x25: fix null_x25_address handling
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>
-rw-r--r-- | net/x25/af_x25.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 5226a7f43050..5121729b8b63 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, | |||
288 | sk_for_each(s, &x25_list) | 288 | sk_for_each(s, &x25_list) |
289 | if ((!strcmp(addr->x25_addr, | 289 | if ((!strcmp(addr->x25_addr, |
290 | x25_sk(s)->source_addr.x25_addr) || | 290 | x25_sk(s)->source_addr.x25_addr) || |
291 | !strcmp(addr->x25_addr, | 291 | !strcmp(x25_sk(s)->source_addr.x25_addr, |
292 | null_x25_address.x25_addr)) && | 292 | null_x25_address.x25_addr)) && |
293 | s->sk_state == TCP_LISTEN) { | 293 | s->sk_state == TCP_LISTEN) { |
294 | /* | 294 | /* |
@@ -688,11 +688,15 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
688 | goto out; | 688 | goto out; |
689 | } | 689 | } |
690 | 690 | ||
691 | len = strlen(addr->sx25_addr.x25_addr); | 691 | /* check for the null_x25_address */ |
692 | for (i = 0; i < len; i++) { | 692 | if (strcmp(addr->sx25_addr.x25_addr, null_x25_address.x25_addr)) { |
693 | if (!isdigit(addr->sx25_addr.x25_addr[i])) { | 693 | |
694 | rc = -EINVAL; | 694 | len = strlen(addr->sx25_addr.x25_addr); |
695 | goto out; | 695 | for (i = 0; i < len; i++) { |
696 | if (!isdigit(addr->sx25_addr.x25_addr[i])) { | ||
697 | rc = -EINVAL; | ||
698 | goto out; | ||
699 | } | ||
696 | } | 700 | } |
697 | } | 701 | } |
698 | 702 | ||