linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] sctp: check assoc before SCTP_ADDR_{MADE_PRIM,ADDED} event
@ 2020-05-27  9:56 Jonas Falkevik
  2020-05-27 22:10 ` Marcelo Ricardo Leitner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jonas Falkevik @ 2020-05-27  9:56 UTC (permalink / raw)
  To: marcelo.leitner, lucien.xin, nhorman, vyasevich, davem, kuba,
	linux-sctp, netdev, linux-kernel
  Cc: Jonas Falkevik

Make sure SCTP_ADDR_{MADE_PRIM,ADDED} are sent only for associations
that have been established.

These events are described in rfc6458#section-6.1
SCTP_PEER_ADDR_CHANGE:
This tag indicates that an address that is
part of an existing association has experienced a change of
state (e.g., a failure or return to service of the reachability
of an endpoint via a specific transport address).

Signed-off-by: Jonas Falkevik <jonas.falkevik@gmail.com>
---
Changes in v2:
 - Check asoc state to be at least established.
   Instead of associd being SCTP_FUTURE_ASSOC.
 - Common check for all peer addr change event

 net/sctp/ulpevent.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index c82dbdcf13f2..77d5c36a8991 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -343,6 +343,9 @@ void sctp_ulpevent_nofity_peer_addr_change(struct sctp_transport *transport,
 	struct sockaddr_storage addr;
 	struct sctp_ulpevent *event;
 
+	if (asoc->state < SCTP_STATE_ESTABLISHED)
+		return;
+
 	memset(&addr, 0, sizeof(struct sockaddr_storage));
 	memcpy(&addr, &transport->ipaddr, transport->af_specific->sockaddr_len);
 
-- 
2.25.4


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

* Re: [PATCH v2] sctp: check assoc before SCTP_ADDR_{MADE_PRIM,ADDED} event
  2020-05-27  9:56 [PATCH v2] sctp: check assoc before SCTP_ADDR_{MADE_PRIM,ADDED} event Jonas Falkevik
@ 2020-05-27 22:10 ` Marcelo Ricardo Leitner
  2020-05-28  5:59 ` Xin Long
  2020-05-28 19:47 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marcelo Ricardo Leitner @ 2020-05-27 22:10 UTC (permalink / raw)
  To: Jonas Falkevik
  Cc: lucien.xin, nhorman, vyasevich, davem, kuba, linux-sctp, netdev,
	linux-kernel

On Wed, May 27, 2020 at 11:56:40AM +0200, Jonas Falkevik wrote:
> Make sure SCTP_ADDR_{MADE_PRIM,ADDED} are sent only for associations
> that have been established.
> 
> These events are described in rfc6458#section-6.1
> SCTP_PEER_ADDR_CHANGE:
> This tag indicates that an address that is
> part of an existing association has experienced a change of
> state (e.g., a failure or return to service of the reachability
> of an endpoint via a specific transport address).
> 
> Signed-off-by: Jonas Falkevik <jonas.falkevik@gmail.com>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Thanks!

> ---
> Changes in v2:
>  - Check asoc state to be at least established.
>    Instead of associd being SCTP_FUTURE_ASSOC.
>  - Common check for all peer addr change event
> 
>  net/sctp/ulpevent.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
> index c82dbdcf13f2..77d5c36a8991 100644
> --- a/net/sctp/ulpevent.c
> +++ b/net/sctp/ulpevent.c
> @@ -343,6 +343,9 @@ void sctp_ulpevent_nofity_peer_addr_change(struct sctp_transport *transport,
>  	struct sockaddr_storage addr;
>  	struct sctp_ulpevent *event;
>  
> +	if (asoc->state < SCTP_STATE_ESTABLISHED)
> +		return;
> +
>  	memset(&addr, 0, sizeof(struct sockaddr_storage));
>  	memcpy(&addr, &transport->ipaddr, transport->af_specific->sockaddr_len);
>  
> -- 
> 2.25.4
> 

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

* Re: [PATCH v2] sctp: check assoc before SCTP_ADDR_{MADE_PRIM,ADDED} event
  2020-05-27  9:56 [PATCH v2] sctp: check assoc before SCTP_ADDR_{MADE_PRIM,ADDED} event Jonas Falkevik
  2020-05-27 22:10 ` Marcelo Ricardo Leitner
@ 2020-05-28  5:59 ` Xin Long
  2020-05-28 19:47 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Xin Long @ 2020-05-28  5:59 UTC (permalink / raw)
  To: Jonas Falkevik
  Cc: Marcelo Ricardo Leitner, Neil Horman, Vlad Yasevich, davem,
	Jakub Kicinski, linux-sctp, network dev, LKML

On Wed, May 27, 2020 at 5:57 PM Jonas Falkevik <jonas.falkevik@gmail.com> wrote:
>
> Make sure SCTP_ADDR_{MADE_PRIM,ADDED} are sent only for associations
> that have been established.
>
> These events are described in rfc6458#section-6.1
> SCTP_PEER_ADDR_CHANGE:
> This tag indicates that an address that is
> part of an existing association has experienced a change of
> state (e.g., a failure or return to service of the reachability
> of an endpoint via a specific transport address).
>
> Signed-off-by: Jonas Falkevik <jonas.falkevik@gmail.com>
Reviewed-by: Xin Long <lucien.xin@gmail.com>

> ---
> Changes in v2:
>  - Check asoc state to be at least established.
>    Instead of associd being SCTP_FUTURE_ASSOC.
>  - Common check for all peer addr change event
>
>  net/sctp/ulpevent.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
> index c82dbdcf13f2..77d5c36a8991 100644
> --- a/net/sctp/ulpevent.c
> +++ b/net/sctp/ulpevent.c
> @@ -343,6 +343,9 @@ void sctp_ulpevent_nofity_peer_addr_change(struct sctp_transport *transport,
>         struct sockaddr_storage addr;
>         struct sctp_ulpevent *event;
>
> +       if (asoc->state < SCTP_STATE_ESTABLISHED)
> +               return;
> +
>         memset(&addr, 0, sizeof(struct sockaddr_storage));
>         memcpy(&addr, &transport->ipaddr, transport->af_specific->sockaddr_len);
>
> --
> 2.25.4
>

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

* Re: [PATCH v2] sctp: check assoc before SCTP_ADDR_{MADE_PRIM,ADDED} event
  2020-05-27  9:56 [PATCH v2] sctp: check assoc before SCTP_ADDR_{MADE_PRIM,ADDED} event Jonas Falkevik
  2020-05-27 22:10 ` Marcelo Ricardo Leitner
  2020-05-28  5:59 ` Xin Long
@ 2020-05-28 19:47 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-05-28 19:47 UTC (permalink / raw)
  To: jonas.falkevik
  Cc: marcelo.leitner, lucien.xin, nhorman, vyasevich, kuba,
	linux-sctp, netdev, linux-kernel

From: Jonas Falkevik <jonas.falkevik@gmail.com>
Date: Wed, 27 May 2020 11:56:40 +0200

> Make sure SCTP_ADDR_{MADE_PRIM,ADDED} are sent only for associations
> that have been established.
> 
> These events are described in rfc6458#section-6.1
> SCTP_PEER_ADDR_CHANGE:
> This tag indicates that an address that is
> part of an existing association has experienced a change of
> state (e.g., a failure or return to service of the reachability
> of an endpoint via a specific transport address).
> 
> Signed-off-by: Jonas Falkevik <jonas.falkevik@gmail.com>
> ---
> Changes in v2:
>  - Check asoc state to be at least established.
>    Instead of associd being SCTP_FUTURE_ASSOC.
>  - Common check for all peer addr change event

Applied and queued up for -stable, thanks.

 


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

end of thread, other threads:[~2020-05-28 19:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27  9:56 [PATCH v2] sctp: check assoc before SCTP_ADDR_{MADE_PRIM,ADDED} event Jonas Falkevik
2020-05-27 22:10 ` Marcelo Ricardo Leitner
2020-05-28  5:59 ` Xin Long
2020-05-28 19:47 ` David Miller

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).