linux-scsi.vger.kernel.org archive mirror
 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

* Re: [PATCH] scsi_debug: num_tgts must be >= 0
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Douglas Gilbert @ 2019-11-16  3:30 UTC (permalink / raw)
  To: Maurizio Lombardi, jejb; +Cc: martin.petersen, linux-scsi

On 2019-11-16 3:37 a.m., Maurizio Lombardi wrote:
> Passing the parameter "num_tgts=-1" will start
> an infinite loop that exhausts the system memory

Ouch.

> Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>

Acked-by: Douglas Gilbert <dgilbert@interlog.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;
> 


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

* Re: [PATCH] scsi_debug: num_tgts must be >= 0
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-11-19  4:41 UTC (permalink / raw)
  To: Maurizio Lombardi; +Cc: jejb, martin.petersen, linux-scsi


Maurizio,

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

Applied to 5.5/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[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;
as well as URLs for NNTP newsgroup(s).