Re: [PATCH v2 16/36] target: Stop execution if CMD_T_STOP has been set

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

 



On Wed, 2017-02-01 at 16:58 -0800, Bart Van Assche wrote:
> Stop execution in the unlikely scenario that CMD_T_STOP has been
> set for a command just after the command has been added to the
> device command list and before .write_pending() is called.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
> Reviewed-by: Hannes Reinecke <hare@xxxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: Andy Grover <agrover@xxxxxxxxxx>
> Cc: David Disseldorp <ddiss@xxxxxxx>
> ---
>  drivers/target/target_core_transport.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> index 782b511c4f5f..d241c4d27352 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -2456,7 +2456,8 @@ transport_generic_new_cmd(struct se_cmd *cmd)
>  		target_execute_cmd(cmd);
>  		return 0;
>  	}
> -	transport_cmd_check_stop(cmd, false, true);
> +	if (transport_cmd_check_stop(cmd, false, true))
> +		return 0;
>  
>  	ret = cmd->se_tfo->write_pending(cmd);
>  	if (ret == -EAGAIN || ret == -ENOMEM)

Nice catch on this btw.

I've not seen folks being able to hit this, which it could certainly
result in unexpected behavior if the CMD_T_STOP check was true in
transport_cmd_check_stop() -> complete_all(&cmd->t_transport_stop_comp)
happened, but this caller did not return and ->write_pending() was
invoked after CMD_T_STOP.

That said, it might be a good candidate for stable.


--
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