Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1121567pxx; Tue, 27 Oct 2020 08:44:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCiXy+buunw2HuE7be/FbqojXCnfSO3HIoynMf1Ntslw9ULjMUjjDZhbCpkFu882PNuCYw X-Received: by 2002:a05:6402:1615:: with SMTP id f21mr3000044edv.257.1603813478857; Tue, 27 Oct 2020 08:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603813478; cv=none; d=google.com; s=arc-20160816; b=iSOnTC6DRj8xJUDEm676LLCZ368p0zNiOnHN1hXZMrwLLufWcNLOegAPyfFf23q7x/ xCnWGkDW2YA2xDcZqyDHaF2cvE+qgYLi+QnDKreqlctbqlXdGaOo6U9Yh5iLNxwVfv7F gJG6Oqj4TcV4ugl/byhDWR6u/dKhb25+Ol5UDSDv0RZXxEsmO4GuH+8ggxzShx70vZmv yvXQWoj5LUjEp2jEJbM0Gx++hFzRBoMFBoKbbi88RgoBhFgbZaIDvwc2zVXcDblZ1JLR yWUtiyhGzrYLOYgtXl11v4VtRfHH8ZCSP7A2BJotRKuRZB2P7GnFoFDCrRuE9qcviSbk cVdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OfBcjalMLZ5zs0pyMGAS4wZal5n6EWfA2yTUjk58JA0=; b=NxyOHFM8WYHrzJmFOpk7N74qX/BXq0esfgBJZKYRcSdELL09YZtV85kiUfmVimKr9R lJ+w913VJt/5dsLNP15bg8C0x2HKRQrdXaTbk4baU4DM3YsZoBk6cRW7eZZmAzzX0WWi ikmee9JfNQM3Q4V6AucWjyWSVpr5HXt8enCXHQyVazptCtm3qR/dlZBlVyz3r7xu/Vt1 YdC/3DPuZyKUeHv6aymANP0ENOrD7VIYAwvlnBkJNbGZ/IUq7gdndcjWdVdi3E5/dGhG 1Eli6a2TK6lJmfV+avlxpO6jq0QAF+g3xuhelz7FnxiHXYcsaODOFrwoKVUfpep75vqV /OkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tMC4ANe8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x10si1277678ejf.3.2020.10.27.08.44.16; Tue, 27 Oct 2020 08:44:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tMC4ANe8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1766251AbgJ0Ort (ORCPT + 99 others); Tue, 27 Oct 2020 10:47:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:47558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765111AbgJ0Ork (ORCPT ); Tue, 27 Oct 2020 10:47:40 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 7929220709; Tue, 27 Oct 2020 14:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810059; bh=+f97MW3Ziot5kmxH1SHjTxmPRgZq+m1Ur0geShQzcGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tMC4ANe8OI687sGtPhrWLbfRHABLXMsR+tYKI9X27kl1inB/AMIRK9GUDwYhU+vqE qFf/NBpFxSKKDzPbceodkcjKGOIEm9mFvsY2hadVnK3KSK7erVyZvCfN1TBJiZaDSS WG8sASSIL39q2Zbt1On8e9lj8jMqfcr+VrR5oq/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+23b5f9e7caf61d9a3898@syzkaller.appspotmail.com, Julian Anastasov , Peilin Ye , Simon Horman , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.4 388/408] ipvs: Fix uninit-value in do_ip_vs_set_ctl() Date: Tue, 27 Oct 2020 14:55:26 +0100 Message-Id: <20201027135512.982460341@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peilin Ye [ Upstream commit c5a8a8498eed1c164afc94f50a939c1a10abf8ad ] do_ip_vs_set_ctl() is referencing uninitialized stack value when `len` is zero. Fix it. Reported-by: syzbot+23b5f9e7caf61d9a3898@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?id=46ebfb92a8a812621a001ef04d90dfa459520fe2 Suggested-by: Julian Anastasov Signed-off-by: Peilin Ye Acked-by: Julian Anastasov Reviewed-by: Simon Horman Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/ipvs/ip_vs_ctl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 3cccc88ef817b..99168af0c28d9 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -2465,6 +2465,10 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) /* Set timeout values for (tcp tcpfin udp) */ ret = ip_vs_set_timeout(ipvs, (struct ip_vs_timeout_user *)arg); goto out_unlock; + } else if (!len) { + /* No more commands with len == 0 below */ + ret = -EINVAL; + goto out_unlock; } usvc_compat = (struct ip_vs_service_user *)arg; @@ -2541,9 +2545,6 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) break; case IP_VS_SO_SET_DELDEST: ret = ip_vs_del_dest(svc, &udest); - break; - default: - ret = -EINVAL; } out_unlock: -- 2.25.1