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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 05 Mar 2010 07:28:03 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Zhu Yi <yi.zhu@...el.com>
Cc:	davem@...emloft.net, netdev@...r.kernel.org,
	Vlad Yasevich <vladislav.yasevich@...com>,
	Sridhar Samudrala <sri@...ibm.com>
Subject: Re: [PATCH V3 5/8] sctp: use limited socket backlog

Le vendredi 05 mars 2010 à 12:01 +0800, Zhu Yi a écrit :
> Make sctp adapt to the limited socket backlog change.
> 
> Cc: Vlad Yasevich <vladislav.yasevich@...com>
> Cc: Sridhar Samudrala <sri@...ibm.com>
> Signed-off-by: Zhu Yi <yi.zhu@...el.com>

This patch looks wrong.


> -static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb)
> +static int sctp_add_backlog(struct sock *sk, struct sk_buff *skb)
>  {
>  	struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk;
>  	struct sctp_ep_common *rcvr = chunk->rcvr;
> +	int ret;
>  
> -	/* Hold the assoc/ep while hanging on the backlog queue.
> -	 * This way, we know structures we need will not disappear from us
> -	 */
> -	if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type)
> -		sctp_association_hold(sctp_assoc(rcvr));
> -	else if (SCTP_EP_TYPE_SOCKET == rcvr->type)
> -		sctp_endpoint_hold(sctp_ep(rcvr));
> -	else
> -		BUG();
> +	ret = sk_add_backlog_limited(sk, skb);
> +	if (!ret) {
> +		/* Hold the assoc/ep while hanging on the backlog queue.
> +		 * This way, we know structures we need will not disappear
> +		 * from us
> +		 */
> +		if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type)
> +			sctp_association_hold(sctp_assoc(rcvr));
> +		else if (SCTP_EP_TYPE_SOCKET == rcvr->type)
> +			sctp_endpoint_hold(sctp_ep(rcvr));
> +		else
> +			BUG();
> +	}
> +	return ret;
>  
> -	sk_add_backlog(sk, skb);
>  }
>  

As advertized by comment, we should hold the association *before*
accessing backlog queue.

If order is not important, comment should be relaxed somehow ?


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