Skip to contentSkip to conversation

scsi_debug: num_tgts must be >= 0

PATCH Applied Maurizio Lombardi 3 participants 3 messages Nov 15, 2019 – Nov 19, 2019 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_debug: num_tgts must be >= 0

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

---
 drivers/scsi/scsi_debug.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/scsi/scsi_debug.c +5 -0
index d323523f5f9d..32965ec76965 100644
@@ -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;
Signature · 1 line
Maurizio Lombardi
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Maurizio Lombardi

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

Ouch.

Quoted 1 line
Quoted 21 lines
---
  drivers/scsi/scsi_debug.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/scsi/scsi_debug.c +5 -0
index d323523f5f9d..32965ec76965 100644
@@ -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 lore raw
In reply to Maurizio Lombardi

Maurizio,

Quoted 2 lines

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

Applied to 5.5/scsi-queue, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering