summaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorMaurizio Lombardi <mlombard@redhat.com>2019-11-15 17:37:27 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2019-11-19 21:37:34 -0500
commitaa5334c4f3014940f11bf876e919c956abef4089 (patch)
treea14d01f52422a149be4191c004fc481c7cfe931b /drivers/scsi
parent4583a4f66b323c6e4d774be2649e83a4e7c7b78c (diff)
scsi: scsi_debug: num_tgts must be >= 0
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>
Diffstat (limited to 'drivers/scsi')
-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 4daf2637c011..44cb054d5e66 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;