diff options
author | Jon Maloy <jon.maloy@ericsson.com> | 2018-02-26 14:14:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-27 11:46:03 -0500 |
commit | 1b22bcad7e397252ecc9a8c471334f70b46820fc (patch) | |
tree | a89ec297430075d8a6a90ac6aa088d7b15744642 /net/tipc | |
parent | 3d18e4f19f37062a0f2cbcf3ac17eaabdde04704 (diff) |
tipc: correct initial value for group congestion flag
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.
Fixes: 60c253069632 ("tipc: fix race between poll() and setsockopt()")
Reported-by: Hoang Le <hoang.h.le@dektek.com.au>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/group.c | 1 | ||||
-rw-r--r-- | net/tipc/socket.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/net/tipc/group.c b/net/tipc/group.c index 122162a31816..04e516d18054 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, | |||
189 | grp->loopback = mreq->flags & TIPC_GROUP_LOOPBACK; | 189 | grp->loopback = mreq->flags & TIPC_GROUP_LOOPBACK; |
190 | grp->events = mreq->flags & TIPC_GROUP_MEMBER_EVTS; | 190 | grp->events = mreq->flags & TIPC_GROUP_MEMBER_EVTS; |
191 | grp->open = group_is_open; | 191 | grp->open = group_is_open; |
192 | *grp->open = false; | ||
192 | filter |= global ? TIPC_SUB_CLUSTER_SCOPE : TIPC_SUB_NODE_SCOPE; | 193 | filter |= global ? TIPC_SUB_CLUSTER_SCOPE : TIPC_SUB_NODE_SCOPE; |
193 | if (tipc_topsrv_kern_subscr(net, portid, type, 0, ~0, | 194 | if (tipc_topsrv_kern_subscr(net, portid, type, 0, ~0, |
194 | filter, &grp->subid)) | 195 | filter, &grp->subid)) |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index b0323ec7971e..7dfa9fc99ec3 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, | |||
473 | sk->sk_write_space = tipc_write_space; | 473 | sk->sk_write_space = tipc_write_space; |
474 | sk->sk_destruct = tipc_sock_destruct; | 474 | sk->sk_destruct = tipc_sock_destruct; |
475 | tsk->conn_timeout = CONN_TIMEOUT_DEFAULT; | 475 | tsk->conn_timeout = CONN_TIMEOUT_DEFAULT; |
476 | tsk->group_is_open = true; | ||
476 | atomic_set(&tsk->dupl_rcvcnt, 0); | 477 | atomic_set(&tsk->dupl_rcvcnt, 0); |
477 | 478 | ||
478 | /* Start out with safe limits until we receive an advertised window */ | 479 | /* Start out with safe limits until we receive an advertised window */ |