netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net 1/1] tipc: correct initial value for group congestion flag
@ 2018-02-26 19:14 Jon Maloy
  2018-02-27 16:47 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jon Maloy @ 2018-02-26 19:14 UTC (permalink / raw)
  To: davem, netdev
  Cc: tipc-discussion, hoang.h.le, mohan.krishna.ghanta.krishnamurthy

In commit 60c253069632 ("tipc: fix race between poll() and
setsockopt()") we introduced a pointer from struct tipc_group to the
'group_is_connected' flag in struct tipc_sock, so that this field can
be checked without dereferencing the group pointer of the latter struct.

The initial value for this flag is correctly set to 'false' when a
group is created, but we miss the case when no group is created at
all, in which case the initial value should be 'true'. This has the
effect that SOCK_RDM/DGRAM sockets sending datagrams never receive
POLLOUT if they request so.

This commit corrects this bug.

Reported-by: Hoang Le <hoang.h.le@dektek.com.au>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
 net/tipc/group.c  | 1 +
 net/tipc/socket.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/net/tipc/group.c b/net/tipc/group.c
index 03086cc..d7a7bef 100644
--- a/net/tipc/group.c
+++ b/net/tipc/group.c
@@ -189,6 +189,7 @@ struct tipc_group *tipc_group_create(struct net *net, u32 portid,
 	grp->loopback = mreq->flags & TIPC_GROUP_LOOPBACK;
 	grp->events = mreq->flags & TIPC_GROUP_MEMBER_EVTS;
 	grp->open = group_is_open;
+	*grp->open = false;
 	filter |= global ? TIPC_SUB_CLUSTER_SCOPE : TIPC_SUB_NODE_SCOPE;
 	if (tipc_topsrv_kern_subscr(net, portid, type, 0, ~0,
 				    filter, &grp->subid))
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index f934771..8b04e60 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -473,6 +473,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock,
 	sk->sk_write_space = tipc_write_space;
 	sk->sk_destruct = tipc_sock_destruct;
 	tsk->conn_timeout = CONN_TIMEOUT_DEFAULT;
+	tsk->group_is_open = true;
 	atomic_set(&tsk->dupl_rcvcnt, 0);
 
 	/* Start out with safe limits until we receive an advertised window */
-- 
2.1.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

* Re: [net 1/1] tipc: correct initial value for group congestion flag
  2018-02-26 19:14 [net 1/1] tipc: correct initial value for group congestion flag Jon Maloy
@ 2018-02-27 16:47 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-02-27 16:47 UTC (permalink / raw)
  To: jon.maloy
  Cc: netdev, tipc-discussion, hoang.h.le,
	mohan.krishna.ghanta.krishnamurthy

From: Jon Maloy <jon.maloy@ericsson.com>
Date: Mon, 26 Feb 2018 20:14:04 +0100

> In commit 60c253069632 ("tipc: fix race between poll() and
> setsockopt()") we introduced a pointer from struct tipc_group to the
> 'group_is_connected' flag in struct tipc_sock, so that this field can
> be checked without dereferencing the group pointer of the latter struct.
> 
> The initial value for this flag is correctly set to 'false' when a
> group is created, but we miss the case when no group is created at
> all, in which case the initial value should be 'true'. This has the
> effect that SOCK_RDM/DGRAM sockets sending datagrams never receive
> POLLOUT if they request so.
> 
> This commit corrects this bug.
> 
> Reported-by: Hoang Le <hoang.h.le@dektek.com.au>
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>

Applied, thanks.

Please provide a proper Fixes: tag next time.  I added it for you
in this case.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

end of thread, other threads:[~2018-02-27 16:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-26 19:14 [net 1/1] tipc: correct initial value for group congestion flag Jon Maloy
2018-02-27 16: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).