Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp177595pxx; Wed, 28 Oct 2020 01:44:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9xdP49i915x26XCi6OG/PfJJS1EhfdnXbJyyYiMCtJV+le90s8f7twSySCVcf9fHM0aNG X-Received: by 2002:a17:906:f0ce:: with SMTP id dk14mr6713864ejb.539.1603874664402; Wed, 28 Oct 2020 01:44:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603874664; cv=none; d=google.com; s=arc-20160816; b=UgV9T1PxZOJDOQxHpzvf6SfgeIF6JQEjIHjiU/dhnFIS/lr/rT3HoWysyfQjguTEzS 91cvr7JBg+1KqyzMFb1xpUYf8no3f6ShIzIvRJSkVWAgj24tt6EjJW3E0W9Iux84bl64 8TQKuTDTkyqPxVz9G4vXmYLm/20v5LMY6IcF0NuKqciOD9v3oGITFqvttBiltFhIjc3o 9rnYaCWTu/qsxx/nnL7J+LSy7cvtZue502Ssyf6lUuO/t/ZOc/brhaaZtul+j2dh6TqZ 1boeAeEbKQSG5h+7tCZvlHoQ8Jl1qDygk74fhOcA8DEUOJpbLRsw6/6CbQzptJb8h1jN /6Iw== 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=mb+C4FyKzVF2t0KTKfnQ+DiUM+PdvPVv4nilkthe2Zc=; b=RZRJxuqRBefccZvhmuK4cuUdeC26roT8TERqtxqLBXUUjuJu8YZtmH5Ya5aHZt8E22 sk6LpkwWAdjXxQfYBsmhOpEoJ+U69W6u9gscdGIP5VGDuTE5mfO+kMzx5hy5pO3nntcr 96tn/v1BTxMQ4EczKu+lZ+dbINIhEvsHOZN5aJKrCikdAG3+gyx5O8hzvgWTE4J+1WyI XiRO1JynR4ptyulIQ7un8wtdVde650knZ4/3XzbqOjvHGL2NGg1ICYuBIIfeXgKwbo51 YRT7Eau8W9qW56/UJdqrqOscLobyX07PewDvTTqoasYxbqULlTJr0R6/7Mej8mvEHkh8 m9PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1i7h5goW; 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.01.44.02; Wed, 28 Oct 2020 01:44:24 -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=1i7h5goW; 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 S1755095AbgJ0OIT (ORCPT + 99 others); Tue, 27 Oct 2020 10:08:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:57264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755083AbgJ0OIQ (ORCPT ); Tue, 27 Oct 2020 10:08:16 -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 BD15C218AC; Tue, 27 Oct 2020 14:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807696; bh=JJMGL4RLKtpAn/y/8PlbHmUpiZ8y01jpw7+6DC6Squk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1i7h5goWpZkhhgY5a1p92e85XJcs6YyFpBES/y/kBJgPBPyvJqcNSaihAEppl7x3d wyyzDAK5Em0FaJMrYz4rchUE8MNt7GGTs5+RSsvhfCy35thwQLnuaPwj39L+UCTO+C N6lpmxkjS11oDDMsw1NpNQPOBtA4BoJZp77m487g= 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.9 130/139] ipvs: Fix uninit-value in do_ip_vs_set_ctl() Date: Tue, 27 Oct 2020 14:50:24 +0100 Message-Id: <20201027134908.324688782@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@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 33125fc009cfd..ba9e711f7e3d6 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -2424,6 +2424,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; @@ -2500,9 +2504,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