Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17927526ybl; Thu, 2 Jan 2020 14:59:54 -0800 (PST) X-Google-Smtp-Source: APXvYqxLhQa7N2hvc410hr1JFzia5oQculehWQkV44KbJwzKCUe0nyXybGvJvfXY/k8DK3B7zLXx X-Received: by 2002:a9d:6d06:: with SMTP id o6mr95370860otp.239.1578005994522; Thu, 02 Jan 2020 14:59:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578005994; cv=none; d=google.com; s=arc-20160816; b=Q+HlwkTpjolSFmV6yCmTIvtQwmG4qg/kthj3Gy1wrkw0Ia25bnH7PC/Zw7UMb9nH3Y UbcD83XE+gBNoIC31XUIIZf0IKRtUy+fPqoiYnMvaJgvNKBDndNNrmWaEDJPNoYkLTvd n19I9pzFn2EeQphY4MPKLwz9VGa81lSzTMrJuA0ntIGbJ0g2uqV9cKrCv6cLnFIcOOli QKzcC6aHnJaA8NkUcfxa4fLrZJKVp4bFAV9ErKtsvCrYITXcQziEEX8gcUhW5xjKv768 W2TNohLsR/LkR/u6QrCnWS8TURQPleg8Q5axcdM2iUNMig8/wkagjRcFIKtputA37VSE aKhA== 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=nSSY6HtS3EwccXe7/0uukDlw3W7MrBLwHEYdK3pbxJQ=; b=GtyXhKSjvclrPl7pOtEg/wPmqY2t9kLSp2H884cgIv4OksZEjZ8JCdx9GJmQR15hSu 3VPj681ANUIX49DOoPUiuj9kLqEp9CdnBvydtGOM/+Xv8pBc44JO6gg7zo40HmVzmJqv nFoT5MeR7Ka3FFjby8BMpVUnqPKYKio4KCncAj0b6/c66lxmwMwycpCBiEpPDSA2mM2o Ba5HjvBL/56gvV++UjM3ITqtp9efBy6pOIZp9+q+9q217ljq14ZRGPZ/0oHXfxgJFlgB AhgcCmYHk0Z12DPsGUfWCn21Cp9Os/cgSMAPCVHvdh0fOqnqTGKFT89y4eifpZqFbZ2f ozRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=emamTCTo; 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 u16si27784677otq.92.2020.01.02.14.59.42; Thu, 02 Jan 2020 14:59:54 -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=emamTCTo; 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 S1728222AbgABW6e (ORCPT + 99 others); Thu, 2 Jan 2020 17:58:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:56370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728074AbgABWP2 (ORCPT ); Thu, 2 Jan 2020 17:15:28 -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 7078322314; Thu, 2 Jan 2020 22:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003327; bh=uj2F/Bn3vJZFnGw988xr2Yfv8vMIVr6SR5KDEcBLs9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=emamTCToYjfXf+dfD0P32unsBwTkph1qk9sbERKjOEuUrwxXAthDBXhNadaBpYYbk /RYxkXv0uDgqKHFi4RG0a+iADPleAvr/laqfUIKAWGyyKPuJHAhhWCO7Y0gVzL/ZAn 6C6APMg4JZhB0ALBKz0+QvqtCwDieKoOI/XELfcI= 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 5.4 089/191] scsi: scsi_debug: num_tgts must be >= 0 Date: Thu, 2 Jan 2020 23:06:11 +0100 Message-Id: <20200102215839.473237715@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@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 d323523f5f9d..32965ec76965 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5263,6 +5263,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