public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi_debug: num_tgts must be >= 0
@ 2019-11-15 16:37 Maurizio Lombardi
  2019-11-16  3:30 ` Douglas Gilbert
  2019-11-19  4:41 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Maurizio Lombardi @ 2019-11-15 16:37 UTC (permalink / raw)
  To: jejb; +Cc: martin.petersen, linux-scsi

Passing the parameter "num_tgts=-1" will start
an infinite loop that exhausts the system memory

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
 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;
-- 
Maurizio Lombardi


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-19  4:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-15 16:37 [PATCH] scsi_debug: num_tgts must be >= 0 Maurizio Lombardi
2019-11-16  3:30 ` Douglas Gilbert
2019-11-19  4:41 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox