Skip to content

Commit aa5334c

Browse files
maurizio-lombardimartinkpetersen
authored andcommitted
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/[email protected] Signed-off-by: Maurizio Lombardi <[email protected]> Acked-by: Douglas Gilbert <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 4583a4f commit aa5334c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/scsi/scsi_debug.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5263,6 +5263,11 @@ static int __init scsi_debug_init(void)
52635263
return -EINVAL;
52645264
}
52655265

5266+
if (sdebug_num_tgts < 0) {
5267+
pr_err("num_tgts must be >= 0\n");
5268+
return -EINVAL;
5269+
}
5270+
52665271
if (sdebug_guard > 1) {
52675272
pr_err("guard must be 0 or 1\n");
52685273
return -EINVAL;

0 commit comments

Comments
 (0)