Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11793066pjo; Thu, 2 Jan 2020 14:22:33 -0800 (PST) X-Google-Smtp-Source: APXvYqxMK0f20UmQQS13mtTAJnidSchqoV8LOg+qy3aVkyLpq8jqu/jfVMJmRr+TMOvfU9RHz1VQ X-Received: by 2002:a05:6830:1d4c:: with SMTP id p12mr97508952oth.198.1578003752959; Thu, 02 Jan 2020 14:22:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578003752; cv=none; d=google.com; s=arc-20160816; b=YYEN6TorhQstFedV/P15bdJS2BbumJr7JmYMqFh5HcxjnUX2Fb88M0gu6Y8E3lo5Ab 9HLEEF4igdB61imGDlfIwZ8F0KLJ8/N1BqneMiApUoOMKsc7ayV3zZMBaacaR5s8U/XR rKndhq55mCv8+p7PCcWve3OynoSZ0DT3WmOehhRkU66TjecErbGnegHjyi9t1c7lm0NL wigbhAmNItHwQ9nr0AFxwpUKlLYIITYgF9VxtNWynqxDP1SD7mDuputn60K8Fqn4w+g0 AgMjrd54j7oPmANaF15sox8gcrAd2CN3VDNDbf41obSfSG0MiMa79cGqcWUghFOJDjF/ 8YYg== 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=Lukunp/RFZEKwN6WVBspxw0rYlOqm9OlruSz5hqc+uk=; b=RtHOtV55bSJQxByKDoo7nJejucI/eH48zZk7G4EbvPMrZwKvk9QDIaqo30MDLBmeFv 2E3CVi1uE6BcYoX8SADp/JEKntoI6F82jYksclrDLqgCKDg93KBK115SUusElK6h4b0E cBPcHGlYODrMEELZO4jjhqGj6gnrI9Zto0gxTCf4vVN3tFcDyAveIecYRMji6j6560wa TT6WogMDy7j1Awvi+E4jqdXjhB93rWRrJHA0jc5+EBcE1DHFoHZcI/8/Rzh6ktbMxwNF yxl7lo3EqyPRel33ztMWBmm/hQp/VZT59s6RYcs5D4e2jbERjvJEBplsjuOo4wBRil6L FAjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D9x7kpkR; 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 g10si29276314otn.12.2020.01.02.14.22.21; Thu, 02 Jan 2020 14:22:32 -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=D9x7kpkR; 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 S1728655AbgABWVp (ORCPT + 99 others); Thu, 2 Jan 2020 17:21:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:41074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729032AbgABWVj (ORCPT ); Thu, 2 Jan 2020 17:21:39 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 D29C324649; Thu, 2 Jan 2020 22:21:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003699; bh=X0HoWFRX0aHvr5DB4mtrAuXGQysX0wHdE3DBP5LEEOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D9x7kpkR8GE9wjrBGmksq9ydGkkJTpbhkybiwujruu6igaFIZCuJbqLDnNvXFvsXC OPallHBnxb42HxVHZKam6uKrJ+7C2ZVivYc1yp6CQN0FFci0NzQnpQnnWAVoJPy3mg 0HBJk2tsO0UW6QWrD9YgvRLawWeDe1OSuLsXXNQQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maurizio Lombardi , Douglas Gilbert , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 054/114] scsi: scsi_debug: num_tgts must be >= 0 Date: Thu, 2 Jan 2020 23:07:06 +0100 Message-Id: <20200102220034.493876476@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220029.183913184@linuxfoundation.org> References: <20200102220029.183913184@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Maurizio Lombardi [ Upstream commit aa5334c4f3014940f11bf876e919c956abef4089 ] Passing the parameter "num_tgts=-1" will start an infinite loop that exhausts the system memory Link: https://lore.kernel.org/r/20191115163727.24626-1-mlombard@redhat.com Signed-off-by: Maurizio Lombardi Acked-by: Douglas Gilbert Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/scsi_debug.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 65305b3848bc..a1dbae806fde 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5351,6 +5351,11 @@ static int __init scsi_debug_init(void) return -EINVAL; } + if (sdebug_num_tgts < 0) { + pr_err("num_tgts must be >= 0\n"); + return -EINVAL; + } + if (sdebug_guard > 1) { pr_err("guard must be 0 or 1\n"); return -EINVAL; -- 2.20.1