Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3510121imu; Mon, 7 Jan 2019 04:50:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN7sk92JF3MvKnocnza1Yth3uipS8/nSCaysBC8iLz767PGEKhs3nE5Qx50tFxa6dxoc6NWr X-Received: by 2002:a17:902:280b:: with SMTP id e11mr61364289plb.269.1546865409951; Mon, 07 Jan 2019 04:50:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546865409; cv=none; d=google.com; s=arc-20160816; b=FIWJbTYuyTdB+PN6p0Hq9qYX57haBlbqUpVMqcCQ035uobJI+r7HOSp+Y/pTad+rBF TmF/5pqvFKMcXx0Wv21TuIinzgc+RIXtFlGp0wKo2wPLq+QVuz2plYdoVjZ8Yv3DwKtS ct6MBScXYgyM8OUZDCb1vU8DTSOD2fnXhLqerwcKP17fUf6JOW46FwVTwuuDQT70r5QT RZlx6ELIiGvByaHmp39iz2Ut45IHqrhBDo3w25dj+hp/hult4RTwwdsAXOrnVOyog7I/ ttjVZVTHNzD7oYokJSF1XSyVc1hrAhlDR6cNauiMiY6ZjzJ3/sxJmdiMK1VynAqfW60C ieCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dl9oZifW2e9a0hEVYWVJ5VUG4Gs5TaxHwgrZpNrJzVU=; b=kHppm9PFIObbW8IIt4k/N6+Aqrsfu8NOmHXu/GXjGF0hFeXElQbqRuYDRyvqyfwX+Y T5GBlbpKxAUzBjbLS8kZw8c2PXbpysmQqDlf5Ng0u1N98z0ehnzjSPGvepFkkjI7zHOP KI0Mxyw3q6PCpeU9Tyb9RyXbQ3kn7KjKiroBAeLIrf4T/EqgdcVKsNnOXeoPrbc+ryvQ G7brEKobVoJD7nB1aCc7xp+tDmxd+7VUl63YT53IUH/8iklQdYSGE5NEs1DSV7DEsKyD jz1BrhWY1HAshG6pnSeIAdrpfye6ZvHl/IkJ6Dosj0X8D3ARuuobQdueY8vMPA13SHdD bPNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gJENBqEm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i62si18578217pfc.17.2019.01.07.04.49.55; Mon, 07 Jan 2019 04:50:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gJENBqEm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729089AbfAGMsC (ORCPT + 99 others); Mon, 7 Jan 2019 07:48:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:38474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728885AbfAGMsA (ORCPT ); Mon, 7 Jan 2019 07:48:00 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3AABF20859; Mon, 7 Jan 2019 12:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546865279; bh=WRGvlTSk3f9qsQAFynU8JIsVoRIW9NdiKCBIK4yd5Lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gJENBqEmYMuoLJMddjYBVunD1XQmbrEDAJsAV3ghXsK5Clge3rcKK+ariaRAy9AfC o5Ndvxq6YwlLgVsXADFKPxy1EaWJKwBZzeCSi3IoKaKHEf6/lCJRVFlPQGKhnAH1ac 2d9v7iKz+egtCugy2kaArWMuBQpKN329FpmwxBpk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ying Xue , Jon Maloy , Cong Wang , "David S. Miller" , syzbot+99f20222fc5018d2b97a@syzkaller.appspotmail.com Subject: [PATCH 4.19 042/170] tipc: check group dests after tipc_wait_for_cond() Date: Mon, 7 Jan 2019 13:31:09 +0100 Message-Id: <20190107104458.216136135@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107104452.953560660@linuxfoundation.org> References: <20190107104452.953560660@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Cong Wang [ Upstream commit 3c6306d44082ef007a258ae1b86ea58e6974ee3f ] 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 Cc: Jon Maloy Signed-off-by: Cong Wang Acked-by: Jon Maloy Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tipc/socket.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1007,7 +1007,7 @@ static int tipc_send_group_bcast(struct struct sock *sk = sock->sk; struct net *net = sock_net(sk); struct tipc_sock *tsk = tipc_sk(sk); - struct tipc_nlist *dsts = tipc_group_dests(tsk->group); + struct tipc_nlist *dsts; struct tipc_mc_method *method = &tsk->mc_method; bool ack = method->mandatory && method->rcast; int blks = tsk_blocks(MCAST_H_SIZE + dlen); @@ -1016,9 +1016,6 @@ static int tipc_send_group_bcast(struct struct sk_buff_head pkts; int rc = -EHOSTUNREACH; - if (!dsts->local && !dsts->remote) - return -EHOSTUNREACH; - /* Block or return if any destination link or member is congested */ rc = tipc_wait_for_cond(sock, &timeout, !tsk->cong_link_cnt && tsk->group && @@ -1026,6 +1023,10 @@ static int tipc_send_group_bcast(struct if (unlikely(rc)) return rc; + dsts = tipc_group_dests(tsk->group); + if (!dsts->local && !dsts->remote) + return -EHOSTUNREACH; + /* Complete message header */ if (dest) { msg_set_type(hdr, TIPC_GRP_MCAST_MSG);