Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3522186imu; Mon, 7 Jan 2019 05:03:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN6hQ5YiU1R0+i4BmbHGeHwguzSPFmc7RiX1gGjEi+PUi3a3Vc0Q/kqt2NTSborJYOLJ5ji1 X-Received: by 2002:a17:902:9f93:: with SMTP id g19mr60143578plq.195.1546866193572; Mon, 07 Jan 2019 05:03:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546866193; cv=none; d=google.com; s=arc-20160816; b=ffq6QRoP1lDyWtOMcvzfEXF2tc82z+/UCHhrbjhu2TMG1IEIkTJuwqXnkYQr8yvT2+ KcfgN4HFJBDHYzlaEjFDuGfazHtJWjdVP77qfmtwzqcaxcYtTqW+6xFgARbKHH+lIjcg wcEcUo0OjfUspI9y1dvUDSQNyVQ0+pFKkkeGtZYlZOpAJK6XPUaJQ+3lIQZdutjpqueV Mo62YamDqGUbABwT8is7VhjGNUL//ciItmyj7jIl7BnUikdZnJHqEooeMewLoBe7qLDS h4739EfOYWOAIxK+6mzBu27CtUnEgmaIOB5WjhrMMw5d2TASjq3tdl0LJe8EMRiWnaV9 EGhg== 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=DQgaTHhvhi00szpiySRWLzn90L1nXOSKMKpT39lxyWc=; b=Lsdtt43ZJRCmTOoSjJPlErLNJOLcmuunaN+2ZYi1hMtRCX/gvJkP6gkgOWmxUXpldW qz9yTixTdkJa0SvHUsta6zCTh5z7bgVF4icLKoLAgkLKiPYjNclMr/RdMHtktXYk//Bu NH3KQJSeZaX4m3utVD3VFz7mC0qj3FxeAY30KguQBn/7AB6KNwMpU4w9k/K/C105xxpt AJmk3vz6zfzRy2BtLooiHknwAWrL8nAO0e4MufZBfxURww/IdJ8SNrnK+IzkJ0d/62PY BlkQeDxZ6ZWbxHiB7uht/NC07X389+dYf/gsKIOFrkk2IGTa4CX0G3ugC5HlXs6NxeLD gaLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oCGNSeMW; 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 l66si19965581pga.151.2019.01.07.05.02.58; Mon, 07 Jan 2019 05:03:13 -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=oCGNSeMW; 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 S1730530AbfAGNBF (ORCPT + 99 others); Mon, 7 Jan 2019 08:01:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:48526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730525AbfAGNBD (ORCPT ); Mon, 7 Jan 2019 08:01:03 -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 1692D217D4; Mon, 7 Jan 2019 13:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546866062; bh=/L/5+Izm6D5RHlNXjulSiV1Wl/2IV/NmeyyBgp86v/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oCGNSeMW57XLeXY59SSPm+W+cqPQBFH7FYS+eICCI2ApqW4/5/atMUlRcgHcbKfv+ N9sPn1nrBW9BmHg/2ee9gjYSd7bKnZe52e51viJ3kctkoC74DDA7se2kFe4m3eO189 Eoea27rYDFWsodkdg4vSK8hSNhNDpxtvNINEcpuo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+eb4da3a20fad2e52555d@syzkaller.appspotmail.com, Ying Xue , Jon Maloy , Cong Wang , "David S. Miller" Subject: [PATCH 4.14 032/101] tipc: compare remote and local protocols in tipc_udp_enable() Date: Mon, 7 Jan 2019 13:32:20 +0100 Message-Id: <20190107105334.670794353@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107105330.372621917@linuxfoundation.org> References: <20190107105330.372621917@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Cong Wang [ Upstream commit fb83ed496b9a654f60cd1d58a0e1e79ec5694808 ] When TIPC_NLA_UDP_REMOTE is an IPv6 mcast address but TIPC_NLA_UDP_LOCAL is an IPv4 address, a NULL-ptr deref is triggered as the UDP tunnel sock is initialized to IPv4 or IPv6 sock merely based on the protocol in local address. We should just error out when the remote address and local address have different protocols. Reported-by: syzbot+eb4da3a20fad2e52555d@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/udp_media.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/net/tipc/udp_media.c +++ b/net/tipc/udp_media.c @@ -675,6 +675,11 @@ static int tipc_udp_enable(struct net *n if (err) goto err; + if (remote.proto != local.proto) { + err = -EINVAL; + goto err; + } + b->bcast_addr.media_id = TIPC_MEDIA_TYPE_UDP; b->bcast_addr.broadcast = TIPC_BROADCAST_SUPPORT; rcu_assign_pointer(b->media_ptr, ub);