All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org, davem@davemloft.net,
	Neil Horman <nhorman@tuxdriver.com>
Subject: Re: [PATCH net] sctp: init active key for the new asoc in dupcook_a and dupcook_b
Date: Wed, 02 May 2018 12:04:25 +0000	[thread overview]
Message-ID: <20180502120425.GF4977@localhost.localdomain> (raw)
In-Reply-To: <96c2191206cb67ccec250ca1ec66d83dc9f40c9a.1525239464.git.lucien.xin@gmail.com>

On Wed, May 02, 2018 at 01:37:44PM +0800, Xin Long wrote:
> When processing a duplicate cookie-echo chunk, for case 'A' and 'B',
> after sctp_process_init for the new asoc, if auth is enabled for the
> cookie-ack chunk, the active key should also be initialized.
>
> Otherwise, the cookie-ack chunk made later can not be set with auth
> shkey properly, and a crash can even be caused by this, as after
> Commit 1b1e0bc99474 ("sctp: add refcnt support for sh_key"), sctp
> needs to hold the shkey when making control chunks.
>
> Fixes: 1b1e0bc99474 ("sctp: add refcnt support for sh_key")
> Reported-by: Jianwen Ji <jiji@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

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

> ---
>  net/sctp/sm_statefuns.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> index dd0594a..98acfed 100644
> --- a/net/sctp/sm_statefuns.c
> +++ b/net/sctp/sm_statefuns.c
> @@ -1794,6 +1794,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(
>  			       GFP_ATOMIC))
>  		goto nomem;
>
> +	if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC))
> +		goto nomem;
> +
>  	/* Make sure no new addresses are being added during the
>  	 * restart.  Though this is a pretty complicated attack
>  	 * since you'd have to get inside the cookie.
> @@ -1906,6 +1909,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_b(
>  			       GFP_ATOMIC))
>  		goto nomem;
>
> +	if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC))
> +		goto nomem;
> +
>  	/* Update the content of current association.  */
>  	sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc));
>  	sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
> --
> 2.1.0
>

WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org, davem@davemloft.net,
	Neil Horman <nhorman@tuxdriver.com>
Subject: Re: [PATCH net] sctp: init active key for the new asoc in dupcook_a and dupcook_b
Date: Wed, 2 May 2018 09:04:25 -0300	[thread overview]
Message-ID: <20180502120425.GF4977@localhost.localdomain> (raw)
In-Reply-To: <96c2191206cb67ccec250ca1ec66d83dc9f40c9a.1525239464.git.lucien.xin@gmail.com>

On Wed, May 02, 2018 at 01:37:44PM +0800, Xin Long wrote:
> When processing a duplicate cookie-echo chunk, for case 'A' and 'B',
> after sctp_process_init for the new asoc, if auth is enabled for the
> cookie-ack chunk, the active key should also be initialized.
>
> Otherwise, the cookie-ack chunk made later can not be set with auth
> shkey properly, and a crash can even be caused by this, as after
> Commit 1b1e0bc99474 ("sctp: add refcnt support for sh_key"), sctp
> needs to hold the shkey when making control chunks.
>
> Fixes: 1b1e0bc99474 ("sctp: add refcnt support for sh_key")
> Reported-by: Jianwen Ji <jiji@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

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

> ---
>  net/sctp/sm_statefuns.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> index dd0594a..98acfed 100644
> --- a/net/sctp/sm_statefuns.c
> +++ b/net/sctp/sm_statefuns.c
> @@ -1794,6 +1794,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(
>  			       GFP_ATOMIC))
>  		goto nomem;
>
> +	if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC))
> +		goto nomem;
> +
>  	/* Make sure no new addresses are being added during the
>  	 * restart.  Though this is a pretty complicated attack
>  	 * since you'd have to get inside the cookie.
> @@ -1906,6 +1909,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_b(
>  			       GFP_ATOMIC))
>  		goto nomem;
>
> +	if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC))
> +		goto nomem;
> +
>  	/* Update the content of current association.  */
>  	sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc));
>  	sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
> --
> 2.1.0
>

  parent reply	other threads:[~2018-05-02 12:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02  5:37 [PATCH net] sctp: init active key for the new asoc in dupcook_a and dupcook_b Xin Long
2018-05-02  5:37 ` Xin Long
2018-05-02 11:38 ` Neil Horman
2018-05-02 11:38   ` Neil Horman
2018-05-02 12:04 ` Marcelo Ricardo Leitner [this message]
2018-05-02 12:04   ` Marcelo Ricardo Leitner
2018-05-02 15:16 ` David Miller
2018-05-02 15:16   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180502120425.GF4977@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.