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] [day] [month] [year] [list]
Message-ID: <20101013043240.GA28430@bnru01.bnr.st.com>
Date:	Wed, 13 Oct 2010 10:02:45 +0530
From:	Kumar SANGHVI <kumar.sanghvi@...ricsson.com>
To:	Rémi Denis-Courmont <remi@...lab.net>
Cc:	"remi.denis-courmont@...ia.com" <remi.denis-courmont@...ia.com>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	Linus WALLEIJ <linus.walleij@...ricsson.com>,
	Gulshan KARMANI <gulshan.karmani@...ricsson.com>,
	Sudeep DIVAKARAN <sudeep.divakaran@...ricsson.com>
Subject: Re: [PATCH] Phonet: 'connect' socket implementation for Pipe
 controller

Hi Rémi Denis-Courmontt, 

On Tue, Oct 12, 2010 at 18:30:30 +0200, Rémi Denis-Courmont wrote:
> > +	static u8 host_pref_rx_fc[3] = {3, 2, 1}, host_req_tx_fc[3] = {3, 2, 1};
> 
> Why is this 'static' ? Doesn't that break concurrent uses?

Yes. The 'static' is not needed here. I will fix this.
Thanks.

 > +static int pn_socket_connect(struct socket *sock, struct sockaddr *addr,
> > +		int len, int flags)
> > +{
> > +	struct sock *sk = sock->sk;
> > +	struct sockaddr_pn *spn = (struct sockaddr_pn *)addr;
> > +	long timeo;
> > +	int err;
> > +
> > +	lock_sock(sk);
> > +
> > +	if (len < sizeof(struct sockaddr_pn))
> > +		return -EINVAL;
> > +	if (spn->spn_family != AF_PHONET)
> > +		return -EAFNOSUPPORT;
> 
> You should move lock_sock(sk); here, I think.

Yes. I will fix this locking.
Thanks.

> 
> > +
> > +	switch (sock->state) {
> > +	case SS_UNCONNECTED:
> > +		sk->sk_state = TCP_CLOSE;
> > +		break;
> > +	case SS_CONNECTING:
> > +		switch (sk->sk_state) {
> > +		case TCP_SYN_RECV:
> > +			sock->state = SS_CONNECTED;
> > +			err = -EISCONN;
> > +			goto out;
> > +		case TCP_CLOSE:
> > +			err = -EALREADY;
> > +			if (flags & O_NONBLOCK)
> > +				goto out;
> > +			goto wait_connect;
> > +			break;
> 
> I think the kernel policy is against redumdant break statements.

Yes, the break is redundant here. I will fix this.
Thanks.

> 
> > +		}
> > +		break;
> > +	case SS_CONNECTED:
> > +		switch (sk->sk_state) {
> > +		case TCP_SYN_RECV:
> > +			err = -EISCONN;
> > +			goto out;
> > +		case TCP_CLOSE:
> > +			sock->state = SS_UNCONNECTED;
> > +			break;
> > +		}
> > +		break;
> > +	case SS_DISCONNECTING:
> > +	case SS_FREE:
> > +		break;
> > +	}
> > +	sk->sk_state = TCP_CLOSE;
> > +	sock->state = SS_UNCONNECTED;
> 
> This is dead code...

Yes. I will remove the above assignment to sock->state which is not
required at all.
Thanks.

> 
> > +	sk_stream_kill_queues(sk);
> > +
> > +
> > +	sock->state = SS_CONNECTING;
> 
> ...because of this ^ .
> 
> > +	err = sk->sk_prot->connect(sk, addr, len);

Thanks for the review. I will fix and upload v2 version of the patch.
I will also upload a patch on Documentation describing on 'connect' for
Pipe controller logic.

Thanks & regards,
Kumar.
--
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