linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/4] sctp: add some size validations
@ 2021-06-28 19:13 Marcelo Ricardo Leitner
  2021-06-28 19:13 ` [PATCH net 1/4] sctp: validate from_addr_param return Marcelo Ricardo Leitner
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Marcelo Ricardo Leitner @ 2021-06-28 19:13 UTC (permalink / raw)
  To: netdev
  Cc: linux-sctp, Ilja Van Sprundel, Neil Horman, Vlad Yasevich, Xin Long

Ilja Van Sprundel reported that some size validations on inbound
SCTP packets were missing. After some code review, I noticed two
others that are all fixed here.

Thanks Ilja for reporting this.

Marcelo Ricardo Leitner (4):
  sctp: validate from_addr_param return
  sctp: add size validation when walking chunks
  sctp: validate chunk size in __rcv_asconf_lookup
  sctp: add param size validation for SCTP_PARAM_SET_PRIMARY

 include/net/sctp/structs.h |  2 +-
 net/sctp/bind_addr.c       | 19 +++++++++--------
 net/sctp/input.c           | 11 +++++++---
 net/sctp/ipv6.c            |  7 ++++++-
 net/sctp/protocol.c        |  7 ++++++-
 net/sctp/sm_make_chunk.c   | 42 +++++++++++++++++++++++---------------
 6 files changed, 58 insertions(+), 30 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net 1/4] sctp: validate from_addr_param return
  2021-06-28 19:13 [PATCH net 0/4] sctp: add some size validations Marcelo Ricardo Leitner
@ 2021-06-28 19:13 ` Marcelo Ricardo Leitner
  2021-07-27  2:20   ` Ben Hutchings
  2021-06-28 19:13 ` [PATCH net 2/4] sctp: add size validation when walking chunks Marcelo Ricardo Leitner
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Marcelo Ricardo Leitner @ 2021-06-28 19:13 UTC (permalink / raw)
  To: netdev
  Cc: linux-sctp, Ilja Van Sprundel, Neil Horman, Vlad Yasevich, Xin Long

Ilja reported that, simply putting it, nothing was validating that
from_addr_param functions were operating on initialized memory. That is,
the parameter itself was being validated by sctp_walk_params, but it
doesn't check for types and their specific sizes and it could be a 0-length
one, causing from_addr_param to potentially work over the next parameter or
even uninitialized memory.

The fix here is to, in all calls to from_addr_param, check if enough space
is there for the wanted IP address type.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
 include/net/sctp/structs.h |  2 +-
 net/sctp/bind_addr.c       | 19 +++++++++++--------
 net/sctp/input.c           |  6 ++++--
 net/sctp/ipv6.c            |  7 ++++++-
 net/sctp/protocol.c        |  7 ++++++-
 net/sctp/sm_make_chunk.c   | 29 ++++++++++++++++-------------
 6 files changed, 44 insertions(+), 26 deletions(-)

diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 1aa585216f34b5fb8ed875cece1a8c22e43690d3..d49593c72a555600c06ad7159934fb17226cc452 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -461,7 +461,7 @@ struct sctp_af {
 					 int saddr);
 	void		(*from_sk)	(union sctp_addr *,
 					 struct sock *sk);
-	void		(*from_addr_param) (union sctp_addr *,
+	bool		(*from_addr_param) (union sctp_addr *,
 					    union sctp_addr_param *,
 					    __be16 port, int iif);
 	int		(*to_addr_param) (const union sctp_addr *,
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index 53e5ed79f63f34f6d237b5d0683925fe9c49f4a9..59e653b528b1faec6c6fcf73f0dd42633880e08d 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -270,22 +270,19 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
 		rawaddr = (union sctp_addr_param *)raw_addr_list;
 
 		af = sctp_get_af_specific(param_type2af(param->type));
-		if (unlikely(!af)) {
+		if (unlikely(!af) ||
+		    !af->from_addr_param(&addr, rawaddr, htons(port), 0)) {
 			retval = -EINVAL;
-			sctp_bind_addr_clean(bp);
-			break;
+			goto out_err;
 		}
 
-		af->from_addr_param(&addr, rawaddr, htons(port), 0);
 		if (sctp_bind_addr_state(bp, &addr) != -1)
 			goto next;
 		retval = sctp_add_bind_addr(bp, &addr, sizeof(addr),
 					    SCTP_ADDR_SRC, gfp);
-		if (retval) {
+		if (retval)
 			/* Can't finish building the list, clean up. */
-			sctp_bind_addr_clean(bp);
-			break;
-		}
+			goto out_err;
 
 next:
 		len = ntohs(param->length);
@@ -294,6 +291,12 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
 	}
 
 	return retval;
+
+out_err:
+	if (retval)
+		sctp_bind_addr_clean(bp);
+
+	return retval;
 }
 
 /********************************************************************
diff --git a/net/sctp/input.c b/net/sctp/input.c
index d508f6f3dd08a33419c010d7944f9f70cacdd700..8924e2e142c8234dac233e56e923110e266c9834 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -1131,7 +1131,8 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net,
 		if (!af)
 			continue;
 
-		af->from_addr_param(paddr, params.addr, sh->source, 0);
+		if (!af->from_addr_param(paddr, params.addr, sh->source, 0))
+			continue;
 
 		asoc = __sctp_lookup_association(net, laddr, paddr, transportp);
 		if (asoc)
@@ -1174,7 +1175,8 @@ static struct sctp_association *__sctp_rcv_asconf_lookup(
 	if (unlikely(!af))
 		return NULL;
 
-	af->from_addr_param(&paddr, param, peer_port, 0);
+	if (af->from_addr_param(&paddr, param, peer_port, 0))
+		return NULL;
 
 	return __sctp_lookup_association(net, laddr, &paddr, transportp);
 }
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index bd08807c9e44758b56cdf1cad94dda7184e14fb5..5c6f5ced9cfa631ba73c203478a28c07a27498d0 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -551,15 +551,20 @@ static void sctp_v6_to_sk_daddr(union sctp_addr *addr, struct sock *sk)
 }
 
 /* Initialize a sctp_addr from an address parameter. */
-static void sctp_v6_from_addr_param(union sctp_addr *addr,
+static bool sctp_v6_from_addr_param(union sctp_addr *addr,
 				    union sctp_addr_param *param,
 				    __be16 port, int iif)
 {
+	if (ntohs(param->v6.param_hdr.length) < sizeof(struct sctp_ipv6addr_param))
+		return false;
+
 	addr->v6.sin6_family = AF_INET6;
 	addr->v6.sin6_port = port;
 	addr->v6.sin6_flowinfo = 0; /* BUG */
 	addr->v6.sin6_addr = param->v6.addr;
 	addr->v6.sin6_scope_id = iif;
+
+	return true;
 }
 
 /* Initialize an address parameter from a sctp_addr and return the length
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 6f2bbfeec3a4c7e8386f70a470e83063204dc50e..25192b378e2ece85a0d5fe1a13b713fd5b331ca7 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -254,14 +254,19 @@ static void sctp_v4_to_sk_daddr(union sctp_addr *addr, struct sock *sk)
 }
 
 /* Initialize a sctp_addr from an address parameter. */
-static void sctp_v4_from_addr_param(union sctp_addr *addr,
+static bool sctp_v4_from_addr_param(union sctp_addr *addr,
 				    union sctp_addr_param *param,
 				    __be16 port, int iif)
 {
+	if (ntohs(param->v4.param_hdr.length) < sizeof(struct sctp_ipv4addr_param))
+		return false;
+
 	addr->v4.sin_family = AF_INET;
 	addr->v4.sin_port = port;
 	addr->v4.sin_addr.s_addr = param->v4.addr.s_addr;
 	memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero));
+
+	return true;
 }
 
 /* Initialize an address parameter from a sctp_addr and return the length
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 5b44d228b6cacc720300d9f5951115a95a828163..f33a870b483da7123e2ddb4473b6200a1aca5ade 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2346,11 +2346,13 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
 
 	/* Process the initialization parameters.  */
 	sctp_walk_params(param, peer_init, init_hdr.params) {
-		if (!src_match && (param.p->type == SCTP_PARAM_IPV4_ADDRESS ||
-		    param.p->type == SCTP_PARAM_IPV6_ADDRESS)) {
+		if (!src_match &&
+		    (param.p->type == SCTP_PARAM_IPV4_ADDRESS ||
+		     param.p->type == SCTP_PARAM_IPV6_ADDRESS)) {
 			af = sctp_get_af_specific(param_type2af(param.p->type));
-			af->from_addr_param(&addr, param.addr,
-					    chunk->sctp_hdr->source, 0);
+			if (!af->from_addr_param(&addr, param.addr,
+						 chunk->sctp_hdr->source, 0))
+				continue;
 			if (sctp_cmp_addr_exact(sctp_source(chunk), &addr))
 				src_match = 1;
 		}
@@ -2531,7 +2533,8 @@ static int sctp_process_param(struct sctp_association *asoc,
 			break;
 do_addr_param:
 		af = sctp_get_af_specific(param_type2af(param.p->type));
-		af->from_addr_param(&addr, param.addr, htons(asoc->peer.port), 0);
+		if (!af->from_addr_param(&addr, param.addr, htons(asoc->peer.port), 0))
+			break;
 		scope = sctp_scope(peer_addr);
 		if (sctp_in_scope(net, &addr, scope))
 			if (!sctp_assoc_add_peer(asoc, &addr, gfp, SCTP_UNCONFIRMED))
@@ -2632,15 +2635,13 @@ static int sctp_process_param(struct sctp_association *asoc,
 		addr_param = param.v + sizeof(struct sctp_addip_param);
 
 		af = sctp_get_af_specific(param_type2af(addr_param->p.type));
-		if (af == NULL)
+		if (!af)
 			break;
 
-		af->from_addr_param(&addr, addr_param,
-				    htons(asoc->peer.port), 0);
+		if (!af->from_addr_param(&addr, addr_param,
+					 htons(asoc->peer.port), 0))
+			break;
 
-		/* if the address is invalid, we can't process it.
-		 * XXX: see spec for what to do.
-		 */
 		if (!af->addr_valid(&addr, NULL, NULL))
 			break;
 
@@ -3054,7 +3055,8 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
 	if (unlikely(!af))
 		return SCTP_ERROR_DNS_FAILED;
 
-	af->from_addr_param(&addr, addr_param, htons(asoc->peer.port), 0);
+	if (!af->from_addr_param(&addr, addr_param, htons(asoc->peer.port), 0))
+		return SCTP_ERROR_DNS_FAILED;
 
 	/* ADDIP 4.2.1  This parameter MUST NOT contain a broadcast
 	 * or multicast address.
@@ -3331,7 +3333,8 @@ static void sctp_asconf_param_success(struct sctp_association *asoc,
 
 	/* We have checked the packet before, so we do not check again.	*/
 	af = sctp_get_af_specific(param_type2af(addr_param->p.type));
-	af->from_addr_param(&addr, addr_param, htons(bp->port), 0);
+	if (!af->from_addr_param(&addr, addr_param, htons(bp->port), 0))
+		return;
 
 	switch (asconf_param->param_hdr.type) {
 	case SCTP_PARAM_ADD_IP:
-- 
2.31.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net 2/4] sctp: add size validation when walking chunks
  2021-06-28 19:13 [PATCH net 0/4] sctp: add some size validations Marcelo Ricardo Leitner
  2021-06-28 19:13 ` [PATCH net 1/4] sctp: validate from_addr_param return Marcelo Ricardo Leitner
@ 2021-06-28 19:13 ` Marcelo Ricardo Leitner
  2021-06-28 19:13 ` [PATCH net 3/4] sctp: validate chunk size in __rcv_asconf_lookup Marcelo Ricardo Leitner
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Marcelo Ricardo Leitner @ 2021-06-28 19:13 UTC (permalink / raw)
  To: netdev
  Cc: linux-sctp, Ilja Van Sprundel, Neil Horman, Vlad Yasevich, Xin Long

The first chunk in a packet is ensured to be present at the beginning of
sctp_rcv(), as a packet needs to have at least 1 chunk. But the second
one, may not be completely available and ch->length can be over
uninitialized memory.

Fix here is by only trying to walk on the next chunk if there is enough to
hold at least the header, and then proceed with the ch->length validation
that is already there.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
 net/sctp/input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/input.c b/net/sctp/input.c
index 8924e2e142c8234dac233e56e923110e266c9834..f72bff93745c44be0dbfa29e754f2872a7d874c2 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -1247,7 +1247,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net,
 
 		ch = (struct sctp_chunkhdr *)ch_end;
 		chunk_num++;
-	} while (ch_end < skb_tail_pointer(skb));
+	} while (ch_end + sizeof(*ch) < skb_tail_pointer(skb));
 
 	return asoc;
 }
-- 
2.31.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net 3/4] sctp: validate chunk size in __rcv_asconf_lookup
  2021-06-28 19:13 [PATCH net 0/4] sctp: add some size validations Marcelo Ricardo Leitner
  2021-06-28 19:13 ` [PATCH net 1/4] sctp: validate from_addr_param return Marcelo Ricardo Leitner
  2021-06-28 19:13 ` [PATCH net 2/4] sctp: add size validation when walking chunks Marcelo Ricardo Leitner
@ 2021-06-28 19:13 ` Marcelo Ricardo Leitner
  2021-06-28 19:13 ` [PATCH net 4/4] sctp: add param size validation for SCTP_PARAM_SET_PRIMARY Marcelo Ricardo Leitner
  2021-06-28 22:40 ` [PATCH net 0/4] sctp: add some size validations patchwork-bot+netdevbpf
  4 siblings, 0 replies; 8+ messages in thread
From: Marcelo Ricardo Leitner @ 2021-06-28 19:13 UTC (permalink / raw)
  To: netdev
  Cc: linux-sctp, Ilja Van Sprundel, Neil Horman, Vlad Yasevich, Xin Long

In one of the fallbacks that SCTP has for identifying an association for an
incoming packet, it looks for AddIp chunk (from ASCONF) and take a peek.
Thing is, at this stage nothing was validating that the chunk actually had
enough content for that, allowing the peek to happen over uninitialized
memory.

Similar check already exists in actual asconf handling in
sctp_verify_asconf().

Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
 net/sctp/input.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/sctp/input.c b/net/sctp/input.c
index f72bff93745c44be0dbfa29e754f2872a7d874c2..96dea8097dbeb4e29d537292d31dde5f02188389 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -1168,6 +1168,9 @@ static struct sctp_association *__sctp_rcv_asconf_lookup(
 	union sctp_addr_param *param;
 	union sctp_addr paddr;
 
+	if (ntohs(ch->length) < sizeof(*asconf) + sizeof(struct sctp_paramhdr))
+		return NULL;
+
 	/* Skip over the ADDIP header and find the Address parameter */
 	param = (union sctp_addr_param *)(asconf + 1);
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net 4/4] sctp: add param size validation for SCTP_PARAM_SET_PRIMARY
  2021-06-28 19:13 [PATCH net 0/4] sctp: add some size validations Marcelo Ricardo Leitner
                   ` (2 preceding siblings ...)
  2021-06-28 19:13 ` [PATCH net 3/4] sctp: validate chunk size in __rcv_asconf_lookup Marcelo Ricardo Leitner
@ 2021-06-28 19:13 ` Marcelo Ricardo Leitner
  2021-06-28 22:40 ` [PATCH net 0/4] sctp: add some size validations patchwork-bot+netdevbpf
  4 siblings, 0 replies; 8+ messages in thread
From: Marcelo Ricardo Leitner @ 2021-06-28 19:13 UTC (permalink / raw)
  To: netdev
  Cc: linux-sctp, Ilja Van Sprundel, Neil Horman, Vlad Yasevich, Xin Long

When SCTP handles an INIT chunk, it calls for example:
sctp_sf_do_5_1B_init
  sctp_verify_init
    sctp_verify_param
  sctp_process_init
    sctp_process_param
      handling of SCTP_PARAM_SET_PRIMARY

sctp_verify_init() wasn't doing proper size validation and neither the
later handling, allowing it to work over the chunk itself, possibly being
uninitialized memory.

Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
 net/sctp/sm_make_chunk.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index f33a870b483da7123e2ddb4473b6200a1aca5ade..587fb3cb88e29f53148cd21f13a2a86487ce292b 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2166,9 +2166,16 @@ static enum sctp_ierror sctp_verify_param(struct net *net,
 		break;
 
 	case SCTP_PARAM_SET_PRIMARY:
-		if (ep->asconf_enable)
-			break;
-		goto unhandled;
+		if (!ep->asconf_enable)
+			goto unhandled;
+
+		if (ntohs(param.p->length) < sizeof(struct sctp_addip_param) +
+					     sizeof(struct sctp_paramhdr)) {
+			sctp_process_inv_paramlength(asoc, param.p,
+						     chunk, err_chunk);
+			retval = SCTP_IERROR_ABORT;
+		}
+		break;
 
 	case SCTP_PARAM_HOST_NAME_ADDRESS:
 		/* Tell the peer, we won't support this param.  */
-- 
2.31.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net 0/4] sctp: add some size validations
  2021-06-28 19:13 [PATCH net 0/4] sctp: add some size validations Marcelo Ricardo Leitner
                   ` (3 preceding siblings ...)
  2021-06-28 19:13 ` [PATCH net 4/4] sctp: add param size validation for SCTP_PARAM_SET_PRIMARY Marcelo Ricardo Leitner
@ 2021-06-28 22:40 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-28 22:40 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner
  Cc: netdev, linux-sctp, ivansprundel, nhorman, vyasevich, lucien.xin

Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Mon, 28 Jun 2021 16:13:40 -0300 you wrote:
> Ilja Van Sprundel reported that some size validations on inbound
> SCTP packets were missing. After some code review, I noticed two
> others that are all fixed here.
> 
> Thanks Ilja for reporting this.
> 
> Marcelo Ricardo Leitner (4):
>   sctp: validate from_addr_param return
>   sctp: add size validation when walking chunks
>   sctp: validate chunk size in __rcv_asconf_lookup
>   sctp: add param size validation for SCTP_PARAM_SET_PRIMARY
> 
> [...]

Here is the summary with links:
  - [net,1/4] sctp: validate from_addr_param return
    https://git.kernel.org/netdev/net/c/0c5dc070ff3d
  - [net,2/4] sctp: add size validation when walking chunks
    https://git.kernel.org/netdev/net/c/50619dbf8db7
  - [net,3/4] sctp: validate chunk size in __rcv_asconf_lookup
    https://git.kernel.org/netdev/net/c/b6ffe7671b24
  - [net,4/4] sctp: add param size validation for SCTP_PARAM_SET_PRIMARY
    https://git.kernel.org/netdev/net/c/ef6c8d6ccf0c

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net 1/4] sctp: validate from_addr_param return
  2021-06-28 19:13 ` [PATCH net 1/4] sctp: validate from_addr_param return Marcelo Ricardo Leitner
@ 2021-07-27  2:20   ` Ben Hutchings
  2021-07-27 15:10     ` Marcelo Ricardo Leitner
  0 siblings, 1 reply; 8+ messages in thread
From: Ben Hutchings @ 2021-07-27  2:20 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner
  Cc: netdev, linux-sctp, Ilja Van Sprundel, Neil Horman,
	Vlad Yasevich, Xin Long, carnil

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]

On Mon, Jun 28, 2021 at 04:13:41PM -0300, Marcelo Ricardo Leitner wrote:
[...]
> @@ -1174,7 +1175,8 @@ static struct sctp_association *__sctp_rcv_asconf_lookup(
>  	if (unlikely(!af))
>  		return NULL;
>  
> -	af->from_addr_param(&paddr, param, peer_port, 0);
> +	if (af->from_addr_param(&paddr, param, peer_port, 0))
> +		return NULL;
>  
>  	return __sctp_lookup_association(net, laddr, &paddr, transportp);
>  }
[...]

This condition needs to be inverted, doesn't it?

Ben.

-- 
Ben Hutchings
friends: People who know you well, but like you anyway.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net 1/4] sctp: validate from_addr_param return
  2021-07-27  2:20   ` Ben Hutchings
@ 2021-07-27 15:10     ` Marcelo Ricardo Leitner
  0 siblings, 0 replies; 8+ messages in thread
From: Marcelo Ricardo Leitner @ 2021-07-27 15:10 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: netdev, linux-sctp, Ilja Van Sprundel, Neil Horman,
	Vlad Yasevich, Xin Long, carnil

On Tue, Jul 27, 2021 at 04:20:22AM +0200, Ben Hutchings wrote:
> On Mon, Jun 28, 2021 at 04:13:41PM -0300, Marcelo Ricardo Leitner wrote:
> [...]
> > @@ -1174,7 +1175,8 @@ static struct sctp_association *__sctp_rcv_asconf_lookup(
> >  	if (unlikely(!af))
> >  		return NULL;
> >  
> > -	af->from_addr_param(&paddr, param, peer_port, 0);
> > +	if (af->from_addr_param(&paddr, param, peer_port, 0))
> > +		return NULL;
> >  
> >  	return __sctp_lookup_association(net, laddr, &paddr, transportp);
> >  }
> [...]
> 
> This condition needs to be inverted, doesn't it?

Right you are. I'll send a patch today.

Thanks,
Marcelo

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-07-27 15:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 19:13 [PATCH net 0/4] sctp: add some size validations Marcelo Ricardo Leitner
2021-06-28 19:13 ` [PATCH net 1/4] sctp: validate from_addr_param return Marcelo Ricardo Leitner
2021-07-27  2:20   ` Ben Hutchings
2021-07-27 15:10     ` Marcelo Ricardo Leitner
2021-06-28 19:13 ` [PATCH net 2/4] sctp: add size validation when walking chunks Marcelo Ricardo Leitner
2021-06-28 19:13 ` [PATCH net 3/4] sctp: validate chunk size in __rcv_asconf_lookup Marcelo Ricardo Leitner
2021-06-28 19:13 ` [PATCH net 4/4] sctp: add param size validation for SCTP_PARAM_SET_PRIMARY Marcelo Ricardo Leitner
2021-06-28 22:40 ` [PATCH net 0/4] sctp: add some size validations patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).