lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 08 Jul 2008 02:30:08 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	vladislav.yasevich@...com
Cc:	linux-sctp@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] sctp: Mark the tsn as received after all allocations
 finish

From: Vlad Yasevich <vladislav.yasevich@...com>
Date: Mon,  7 Jul 2008 17:10:41 -0400

> If we don't have the buffer space or memory allocations fail,
> the data chunk is dropped, but TSN is still reported as received.
> This introduced a data loss that can't be recovered.  We should
> only mark TSNs are received after memory allocations finish.
> The one exception is the invalid stream identifier, but that's
> due to user error and is reported back to the user.
> 
> This was noticed by Michael Tuexen.
> 
> Signed-off-by: Vlad Yasevich <vladislav.yasevich@...com>

Applied and pushed out to net-2.6, thanks Vlad.

In the future please CC: netdev on changes you actually want me to
commit so other networking developers can look it over.

Thanks!

> ---
>  net/sctp/sm_statefuns.c |    9 +++------
>  net/sctp/ulpevent.c     |    5 +++++
>  2 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> index 0c9d5a6..fcdb45d 100644
> --- a/net/sctp/sm_statefuns.c
> +++ b/net/sctp/sm_statefuns.c
> @@ -5899,12 +5899,6 @@ static int sctp_eat_data(const struct sctp_association *asoc,
>  		return SCTP_IERROR_NO_DATA;
>  	}
>  
> -	/* If definately accepting the DATA chunk, record its TSN, otherwise
> -	 * wait for renege processing.
> -	 */
> -	if (SCTP_CMD_CHUNK_ULP == deliver)
> -		sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_TSN, SCTP_U32(tsn));
> -
>  	chunk->data_accepted = 1;
>  
>  	/* Note: Some chunks may get overcounted (if we drop) or overcounted
> @@ -5924,6 +5918,9 @@ static int sctp_eat_data(const struct sctp_association *asoc,
>  	 * and discard the DATA chunk.
>  	 */
>  	if (ntohs(data_hdr->stream) >= asoc->c.sinit_max_instreams) {
> +		/* Mark tsn as received even though we drop it */
> +		sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_TSN, SCTP_U32(tsn));
> +
>  		err = sctp_make_op_error(asoc, chunk, SCTP_ERROR_INV_STRM,
>  					 &data_hdr->stream,
>  					 sizeof(data_hdr->stream));
> diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
> index ce6cda6..a1f654a 100644
> --- a/net/sctp/ulpevent.c
> +++ b/net/sctp/ulpevent.c
> @@ -710,6 +710,11 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
>  	if (!skb)
>  		goto fail;
>  
> +	/* Now that all memory allocations for this chunk succeeded, we
> +	 * can mark it as received so the tsn_map is updated correctly.
> +	 */
> +	sctp_tsnmap_mark(&asoc->peer.tsn_map, ntohl(chunk->subh.data_hdr->tsn));
> +
>  	/* First calculate the padding, so we don't inadvertently
>  	 * pass up the wrong length to the user.
>  	 *
> -- 
> 1.5.3.5
> 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ