public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target: Fix missing length check in spc_emulate_evpd_83()
@ 2014-02-03  8:35 Roland Dreier
  2014-02-03 18:30 ` Nicholas A. Bellinger
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Dreier @ 2014-02-03  8:35 UTC (permalink / raw)
  To: Nicholas A. Bellinger; +Cc: target-devel, linux-scsi

From: Roland Dreier <roland@purestorage.com>

Commit fbfe858fea2a ("target_core_spc: Include target device
descriptor in VPD page 83") added a new length variable, but (due to a
cut and paste mistake?) just checks scsi_name_len against 256 twice.
Fix this to check scsi_target_len for overflow too.

Signed-off-by: Roland Dreier <roland@purestorage.com>
---
 drivers/target/target_core_spc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index 43c5ca9878bc..3bebc71ea033 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -440,8 +440,8 @@ check_scsi_name:
 		padding = ((-scsi_target_len) & 3);
 		if (padding)
 			scsi_target_len += padding;
-		if (scsi_name_len > 256)
-			scsi_name_len = 256;
+		if (scsi_target_len > 256)
+			scsi_target_len = 256;
 
 		buf[off-1] = scsi_target_len;
 		off += scsi_target_len;
-- 
1.9.rc1


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

* Re: [PATCH] target: Fix missing length check in spc_emulate_evpd_83()
  2014-02-03  8:35 [PATCH] target: Fix missing length check in spc_emulate_evpd_83() Roland Dreier
@ 2014-02-03 18:30 ` Nicholas A. Bellinger
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas A. Bellinger @ 2014-02-03 18:30 UTC (permalink / raw)
  To: Roland Dreier; +Cc: target-devel, linux-scsi, Hannes Reinecke

On Mon, 2014-02-03 at 00:35 -0800, Roland Dreier wrote:
> From: Roland Dreier <roland@purestorage.com>
> 
> Commit fbfe858fea2a ("target_core_spc: Include target device
> descriptor in VPD page 83") added a new length variable, but (due to a
> cut and paste mistake?) just checks scsi_name_len against 256 twice.
> Fix this to check scsi_target_len for overflow too.
> 
> Signed-off-by: Roland Dreier <roland@purestorage.com>
> ---

Applied.

Thanks Roland!

--nab

>  drivers/target/target_core_spc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
> index 43c5ca9878bc..3bebc71ea033 100644
> --- a/drivers/target/target_core_spc.c
> +++ b/drivers/target/target_core_spc.c
> @@ -440,8 +440,8 @@ check_scsi_name:
>  		padding = ((-scsi_target_len) & 3);
>  		if (padding)
>  			scsi_target_len += padding;
> -		if (scsi_name_len > 256)
> -			scsi_name_len = 256;
> +		if (scsi_target_len > 256)
> +			scsi_target_len = 256;
>  
>  		buf[off-1] = scsi_target_len;
>  		off += scsi_target_len;

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

end of thread, other threads:[~2014-02-03 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-03  8:35 [PATCH] target: Fix missing length check in spc_emulate_evpd_83() Roland Dreier
2014-02-03 18:30 ` Nicholas A. Bellinger

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