diff options
author | Cong Wang <xiyou.wangcong@gmail.com> | 2018-12-17 02:25:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-12-18 18:44:23 -0500 |
commit | 3c6306d44082ef007a258ae1b86ea58e6974ee3f (patch) | |
tree | 817d7e2f340a57554677de33e228adfe5cc7cdad /net/tipc/socket.c | |
parent | f07d4276892d97671e880190ff195a288b2d8d92 (diff) |
tipc: check group dests after tipc_wait_for_cond()
Similar to commit 143ece654f9f ("tipc: check tsk->group in tipc_wait_for_cond()")
we have to reload grp->dests too after we re-take the sock lock.
This means we need to move the dsts check after tipc_wait_for_cond()
too.
Fixes: 75da2163dbb6 ("tipc: introduce communication groups")
Reported-and-tested-by: syzbot+99f20222fc5018d2b97a@syzkaller.appspotmail.com
Cc: Ying Xue <ying.xue@windriver.com>
Cc: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 656940692a44..8f34db2a9785 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -1009,7 +1009,7 @@ static int tipc_send_group_bcast(struct socket *sock, struct msghdr *m, | |||
1009 | struct sock *sk = sock->sk; | 1009 | struct sock *sk = sock->sk; |
1010 | struct net *net = sock_net(sk); | 1010 | struct net *net = sock_net(sk); |
1011 | struct tipc_sock *tsk = tipc_sk(sk); | 1011 | struct tipc_sock *tsk = tipc_sk(sk); |
1012 | struct tipc_nlist *dsts = tipc_group_dests(tsk->group); | 1012 | struct tipc_nlist *dsts; |
1013 | struct tipc_mc_method *method = &tsk->mc_method; | 1013 | struct tipc_mc_method *method = &tsk->mc_method; |
1014 | bool ack = method->mandatory && method->rcast; | 1014 | bool ack = method->mandatory && method->rcast; |
1015 | int blks = tsk_blocks(MCAST_H_SIZE + dlen); | 1015 | int blks = tsk_blocks(MCAST_H_SIZE + dlen); |
@@ -1018,9 +1018,6 @@ static int tipc_send_group_bcast(struct socket *sock, struct msghdr *m, | |||
1018 | struct sk_buff_head pkts; | 1018 | struct sk_buff_head pkts; |
1019 | int rc = -EHOSTUNREACH; | 1019 | int rc = -EHOSTUNREACH; |
1020 | 1020 | ||
1021 | if (!dsts->local && !dsts->remote) | ||
1022 | return -EHOSTUNREACH; | ||
1023 | |||
1024 | /* Block or return if any destination link or member is congested */ | 1021 | /* Block or return if any destination link or member is congested */ |
1025 | rc = tipc_wait_for_cond(sock, &timeout, | 1022 | rc = tipc_wait_for_cond(sock, &timeout, |
1026 | !tsk->cong_link_cnt && tsk->group && | 1023 | !tsk->cong_link_cnt && tsk->group && |
@@ -1028,6 +1025,10 @@ static int tipc_send_group_bcast(struct socket *sock, struct msghdr *m, | |||
1028 | if (unlikely(rc)) | 1025 | if (unlikely(rc)) |
1029 | return rc; | 1026 | return rc; |
1030 | 1027 | ||
1028 | dsts = tipc_group_dests(tsk->group); | ||
1029 | if (!dsts->local && !dsts->remote) | ||
1030 | return -EHOSTUNREACH; | ||
1031 | |||
1031 | /* Complete message header */ | 1032 | /* Complete message header */ |
1032 | if (dest) { | 1033 | if (dest) { |
1033 | msg_set_type(hdr, TIPC_GRP_MCAST_MSG); | 1034 | msg_set_type(hdr, TIPC_GRP_MCAST_MSG); |