summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurizio Lombardi <mlombard@redhat.com>2019-11-15 19:37:27 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-04 21:13:04 +0300
commit1b4128a55cc02e2afa99ff5aa747070d962ec7e4 (patch)
treec2b9fc3d99c12947d632891a0defaf8c2ff7ca21
parenta4c9fd613eec085df74de61c55138cbc4ba6b84c (diff)
downloadlinux-1b4128a55cc02e2afa99ff5aa747070d962ec7e4.tar.xz
scsi: scsi_debug: num_tgts must be >= 0
[ 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 <mlombard@redhat.com> Acked-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/scsi/scsi_debug.c5
1 files changed, 5 insertions, 0 deletions
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;