From patchwork Thu Jan 2 22:07:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 234759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCFFCC3276F for ; Thu, 2 Jan 2020 22:21:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B26C821835 for ; Thu, 2 Jan 2020 22:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003701; bh=X0HoWFRX0aHvr5DB4mtrAuXGQysX0wHdE3DBP5LEEOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ktH0NnJW/jxpqwHUCLirDv+Og1QHyMCrA0QL96+hQ6T10lKZFjVIMKVHouPSsXzJr 7znDu/TVtknGR+LZdK7E2gJel6/wu4WI2RpK6kXGUhlPJAyHzSjcs0rqBHucuQ2A4u Xj35n2MwSe3KUbEgK28zlTEgNstkVMRV07nhPLcY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728826AbgABWVk (ORCPT ); Thu, 2 Jan 2020 17:21:40 -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 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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;