]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
tipc: correct initial value for group congestion flag
authorJon Maloy <jon.maloy@ericsson.com>
Mon, 26 Feb 2018 19:14:04 +0000 (20:14 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Feb 2018 16:46:03 +0000 (11:46 -0500)
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>
net/tipc/group.c
net/tipc/socket.c

index 122162a3181648bad80f110cb94291f4a282e81f..04e516d18054533a08dfaad83cd833ffffe18a29 100644 (file)
@@ -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))
index b0323ec7971ed04cca532674fc85e9882f03c373..7dfa9fc99ec3d442f89f5fc1a7471f6c00e2b6fd 100644 (file)
@@ -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 */