Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6268250imu; Mon, 21 Jan 2019 06:07:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Mxxhn00+wimOkFNGO8by3Utq9s2WKmS9v1k4Sal93JNBR4guaIovlAdWFU5PIdOuJwWVG X-Received: by 2002:a17:902:934a:: with SMTP id g10mr29123807plp.172.1548079662026; Mon, 21 Jan 2019 06:07:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079661; cv=none; d=google.com; s=arc-20160816; b=uw3eJIMlCFL0tBop+vQ/8l19+dW4Q6xExtbSYGyXcm+sfb6mVyjpEYJCZi6x0XKAUs jnq+fm51gQ8mtTNVuli8EI7TDAgVFPCCN5byDVyqK7tdcrnScE5qhSXqCGNzIECHKzp3 GKeJeXdczAeER2Rs7DeVnHALBrfsX/debqP0RtEZQGhIgb6wOBs9x75zYRtiuzQhEIXs v17NBDqUcGCRTx2HPCwd9Ss++QbAGSVIZctMFsOwFW4VSqcKLAo1COUaJCWGzACVUwxU mWLGnVMopmQzmLX7FwvoeZrKGnZMHsEBY8Hs5OM7HvsyjE+B6XwsYLDUCXryvwfUgTQc CazQ== 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=S1AWogClEBdrPymmMbtpL78WCPPeycfkEUZi2s6LpcA=; b=IkuZ9v8wyaiVKX+h+iHfVs81zxVHVMvKjE0lcN6TO9f993+4UIndpEh9yj1VWa0w2T MN+z0NaRpPRw62iDtqY5PBT9T80zVb97phq74XVdtrRV9TKPAhnU+CEUxMoZm3eUqkWs XOTKL4t5/zc7udUW1U3sZAu4+7SfcBZN0IK1Et21yCGQU4y22zO50dyKcoJ+Jy7D/k/c wyvYYLfDD6MqMUDufqE9UVbEnXMkOQpznmTYJS4lQmPVX1zmNJPixLnTO5GzLRwUSssO wCLO5qjOYrWWzKbc62UqcgGGUSF7P2bKvcBYzeAYmejwJY1Y4jA0AmlxRMe69oStA2be WKBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Okgmftjy; 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 u184si13194045pgd.262.2019.01.21.06.07.26; Mon, 21 Jan 2019 06:07:41 -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=Okgmftjy; 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 S1732657AbfAUOBg (ORCPT + 99 others); Mon, 21 Jan 2019 09:01:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:48632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732202AbfAUOBd (ORCPT ); Mon, 21 Jan 2019 09:01:33 -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 623ED21019; Mon, 21 Jan 2019 14:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548079292; bh=lLXVLHLg11MPO09G0n2JnxiarcDrez7gkxsRPIE3/50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OkgmftjyCVRjHF8P5JIZ8IWy2e43H+GQOSmiV6yEoDc80Cfj2Wd29niVlCNRdJGLx x4phtMCIDOJJmnSfK0ZoxNHWdfdoASJood5czeKsxAo0D3BZjdB7o7NLxk44OWFo8z ohIeP0813dwn4JH8Mohau4gU1Nhijt3zEkLeclIw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Potapenko , Xin Long , syzbot+ae0c70c0c2d40c51bb92@syzkaller.appspotmail.com, Marcelo Ricardo Leitner , Neil Horman , "David S. Miller" Subject: [PATCH 4.19 73/99] sctp: allocate sctp_sockaddr_entry with kzalloc Date: Mon, 21 Jan 2019 14:49:05 +0100 Message-Id: <20190121134916.775172280@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121134913.924726465@linuxfoundation.org> References: <20190121134913.924726465@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: Xin Long commit 400b8b9a2a17918f8ce00786f596f530e7f30d50 upstream. The similar issue as fixed in Commit 4a2eb0c37b47 ("sctp: initialize sin6_flowinfo for ipv6 addrs in sctp_inet6addr_event") also exists in sctp_inetaddr_event, as Alexander noticed. To fix it, allocate sctp_sockaddr_entry with kzalloc for both sctp ipv4 and ipv6 addresses, as does in sctp_v4/6_copy_addrlist(). Reported-by: Alexander Potapenko Signed-off-by: Xin Long Reported-by: syzbot+ae0c70c0c2d40c51bb92@syzkaller.appspotmail.com Acked-by: Marcelo Ricardo Leitner Acked-by: Neil Horman Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sctp/ipv6.c | 5 +---- net/sctp/protocol.c | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c @@ -97,11 +97,9 @@ static int sctp_inet6addr_event(struct n switch (ev) { case NETDEV_UP: - addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); + addr = kzalloc(sizeof(*addr), GFP_ATOMIC); if (addr) { addr->a.v6.sin6_family = AF_INET6; - addr->a.v6.sin6_port = 0; - addr->a.v6.sin6_flowinfo = 0; addr->a.v6.sin6_addr = ifa->addr; addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex; addr->valid = 1; @@ -431,7 +429,6 @@ static void sctp_v6_copy_addrlist(struct addr = kzalloc(sizeof(*addr), GFP_ATOMIC); if (addr) { addr->a.v6.sin6_family = AF_INET6; - addr->a.v6.sin6_port = 0; addr->a.v6.sin6_addr = ifp->addr; addr->a.v6.sin6_scope_id = dev->ifindex; addr->valid = 1; --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -101,7 +101,6 @@ static void sctp_v4_copy_addrlist(struct addr = kzalloc(sizeof(*addr), GFP_ATOMIC); if (addr) { addr->a.v4.sin_family = AF_INET; - addr->a.v4.sin_port = 0; addr->a.v4.sin_addr.s_addr = ifa->ifa_local; addr->valid = 1; INIT_LIST_HEAD(&addr->list); @@ -776,10 +775,9 @@ static int sctp_inetaddr_event(struct no switch (ev) { case NETDEV_UP: - addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); + addr = kzalloc(sizeof(*addr), GFP_ATOMIC); if (addr) { addr->a.v4.sin_family = AF_INET; - addr->a.v4.sin_port = 0; addr->a.v4.sin_addr.s_addr = ifa->ifa_local; addr->valid = 1; spin_lock_bh(&net->sctp.local_addr_lock);