Re: [PATCH] target: Return error to initiator if SET TARGET PORT GROUPS emulation fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Roland,

On Mon, 2012-06-04 at 23:24 -0700, Roland Dreier wrote:
> From: Roland Dreier <roland@xxxxxxxxxxxxxxx>
> 
> The error paths in target_emulate_set_target_port_groups() are all
> essentially "rc = -EINVAL; goto out;" but the code at "out:" ignores
> rc and always returns success.  This means that even if eg explicit
> ALUA is turned off, the initiator will always see a good SCSI status
> for SET TARGET PORT GROUPS.
> 
> Fix this by returning rc as is intended.
> 
> Signed-off-by: Roland Dreier <roland@xxxxxxxxxxxxxxx>
> ---
>  drivers/target/target_core_alua.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
> index e624b83..9179997 100644
> --- a/drivers/target/target_core_alua.c
> +++ b/drivers/target/target_core_alua.c
> @@ -374,8 +374,9 @@ int target_emulate_set_target_port_groups(struct se_cmd *cmd)
>  
>  out:
>  	transport_kunmap_data_sg(cmd);
> -	target_complete_cmd(cmd, GOOD);
> -	return 0;
> +	if (!rc)
> +		target_complete_cmd(cmd, GOOD);
> +	return rc;
>  }
>  

Applied w/ CC to 3.x stable, as it looks like this bug was introduced
with:

commit 05d1c7c0d0db4cc25548d9aadebb416888a82327
Author: Andy Grover <agrover@xxxxxxxxxx>
Date:   Wed Jul 20 19:13:28 2011 +0000

    target: Make all control CDBs scatter-gather

Thanks!

--nab

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux