Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp166276pxx; Wed, 28 Oct 2020 01:20:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2TPJCN/ymfY5xP5u3lnMDqEIOmw4Duy+cYCQEGxuSlKi1d/VHru+Zdw8E/yFEGYL988Ms X-Received: by 2002:a17:906:e15:: with SMTP id l21mr6718567eji.509.1603873215610; Wed, 28 Oct 2020 01:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603873215; cv=none; d=google.com; s=arc-20160816; b=ywSu/LZ+3gEVlB7G5QAx4Zd2nlpLiRqeRHZrIIlD0lIjKmdPIwE174LbFYZ3KO4s4l qwwEYLp7pGAmTnp5DE436SZlwMWBZnmqZTL6RfdWYSbJamu4+46Gqozc5rBto2rxU3Su qxgqd6lEp2/dCVtmPrRuiGLED0RtKOHVsD2sNXHhz1KTmu8zsMRU9MmuEJL2ejNZzt4f dSnZa0eRfVijuZ3I5TxpIG0gEQ+AOytgkTVSLS9/u5X9A+MIrB9DX015bBNsP6uBdrkW rJ6seJ9fphLYfe2AQ/4Bg/kFM8ezDubtg6VjfPcKsMxhIIlhq4JMgjMRum5VQHzofy1v 6D1w== 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=eVszKnblE1SLjHrVmkyWJja7oPPXk3p+oTt0iNyVasc=; b=xHkwmEfMW9bo2Ewv9ww2rh7pSQshjCClqqfcGf254aHLKNG+ZCkt4nHW0u9B/Nm9Bi FTPXej2NUWogxShuSMkHxbWTAOJs3qbfxdSKaM1KA7y8j29qVuJbyQ+IekasQ6l1/yvD KcnqwkKet/n80OKLqDC+Fi8R/SjSZisz5JmY6/GeY0XKeZqtHW8pwObq9UyS7x6qkc7Q GV1stINu/L9GpZ3dCBAcZUnTzqcWfwg/22GqEJ2cJF3YHm+4rZ3xkM6AcOdQI2m79N2L +CLi0rWS13vflxIK+CqNqhFu23CUIxuSVd9PxDZDRck/KdPqfxox2DMVzkM7lWR9IPR3 ZHHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A3tkL0Fk; 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 b6si3402013edu.343.2020.10.28.01.19.52; Wed, 28 Oct 2020 01:20:15 -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=A3tkL0Fk; 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 S1753762AbgJ0OCB (ORCPT + 99 others); Tue, 27 Oct 2020 10:02:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:48734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753617AbgJ0OBK (ORCPT ); Tue, 27 Oct 2020 10:01:10 -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 ED0F722202; Tue, 27 Oct 2020 14:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807269; bh=zhVexCYouzqfF0FkuFMX4oiB5PcQkoVYyq09XIzgkTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A3tkL0FkNckpQ7GaqYEQfteDD0nqW0K5qedSb0mM6ljaiK9NPpss40VKzhcBNXp7l UiHrUUTayIYoupyR7nmZ84ZmpP77i8B99s2fINN91jY7wuod3OrbIN1lZOyJUjV3sO PsokMmVEkdh5pgjxxl0OLTdMqT6Ybt9bap49M2AA= 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 4.4 105/112] ipvs: Fix uninit-value in do_ip_vs_set_ctl() Date: Tue, 27 Oct 2020 14:50:15 +0100 Message-Id: <20201027134905.510490724@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134900.532249571@linuxfoundation.org> References: <20201027134900.532249571@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 b176f76dfaa14..c7ee962a547b9 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -2383,6 +2383,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; @@ -2459,9 +2463,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