Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp192823pxx; Wed, 28 Oct 2020 02:18:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyytOPmTJdj9WC6lD/m4hhp3oEDGJQnUg7aTohXkACtLIOR8/rNRmdb8J0Ev1f+moPwUX58 X-Received: by 2002:a17:906:c149:: with SMTP id dp9mr6904471ejc.88.1603876691999; Wed, 28 Oct 2020 02:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603876691; cv=none; d=google.com; s=arc-20160816; b=OjkGLijNkraFsgBBC5Ff82MVr0wLq8TqZPAbtT2njC2i8N76A/lRIFWstieMNG2dZG 6V7XHYht+UlFf5PvT7bCzZL5tc4aR0+O+FjqqPhVjwx/nEy05xH2F5tvGr0sE4s8b4Ey svPIIXtNd0S+xYtMOuuvp0b1P3eIiDEoyMarloDh8HjjV+SIhPwf098RMjHlFsTnZoeB 5kC7XfcFxtJrKpXPRfHOzKlsBMyq90urW3TmtNkGarH7L4rMrwn3bFro+4kAwqs91/X1 qEtSBay32Ck5L1750ND2xNX94hvRCrado2mrYMoy6M5oVAgb/RFDSFHBUlyGKUB7+iYS wM+A== 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=Xf+8hf2Mp8jdaQYNl+bmvHjrn2Q5HX+sw4Hkq0cQmPo=; b=CdvKiPRJeKCz9JMEor6Uwly+Zw8eRwa1OzAHCWTt75lJBQdT9SyclfR1hOBXwDCmOD b5Cc+9St6I9QARr/p/x0fmziU0HFTiXShBEZ0FBnRRqAd+HCAl/OpVlC0Xy6KDqPBGHn +aCN+tkzYlLfmFEzVqPCVDRcqhRbqkKvg0zfda6sPd0vAi9TQwuOQ5E5UwKbhm9eq9mO cvhTVJBKbZqnxxwTC39jGvag9aa6F+HPS3HdFd5/POCTGM589axJeX28hKIaYIGGNsih KEHgczBC5XjOGIPsXlUNIaJC89c3GHVezB7sm+GlgPxJk+zJMESy8OEpwIKxzJ41DCFr F41A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BYbyqqFa; 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 y19si2789537ejd.730.2020.10.28.02.17.49; Wed, 28 Oct 2020 02:18:11 -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=BYbyqqFa; 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 S1757366AbgJ0OSz (ORCPT + 99 others); Tue, 27 Oct 2020 10:18:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:37996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757053AbgJ0OQB (ORCPT ); Tue, 27 Oct 2020 10:16:01 -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 B7BBD2076A; Tue, 27 Oct 2020 14:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808160; bh=kvq5Va+Jj0JvbL9llGVrEJdatR8nffGjna8c2o1b9G4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BYbyqqFavS6KiJMwDq9JkuvIGBdsXZI/8rco9uV3s/jlZ9wIpqCWw4KEgy/ppHaEz /9POPRRWCPxC74uAqOlTEvHGGNcyEyBx0dDmlaZdzrPyh472j6dbXwOfXTGl9Sb36E CHGhyUHPokPznjmTYX/GNHBDBp282EbLKXIxSa7o= 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.14 179/191] ipvs: Fix uninit-value in do_ip_vs_set_ctl() Date: Tue, 27 Oct 2020 14:50:34 +0100 Message-Id: <20201027134918.341939073@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@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 5ec80818ace2c..c1672ff009637 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -2425,6 +2425,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; @@ -2501,9 +2505,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