Re: [PATCH] scsi: tcmu: fix use after free

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

 



On 01/22/2019 04:10 AM, xiubli@xxxxxxxxxx wrote:
> From: Xiubo Li <xiubli@xxxxxxxxxx>
> 
> Fixes: 4147ebb3 ("scsi: tcmu: avoid cmd/qfull timers updated whenever a new cmd comes")
> 
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Cc: Mike Christie <mchristi@xxxxxxxxxx>
> Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx>
> ---
>  drivers/target/target_core_user.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index ac76201..c46efa4 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -1317,12 +1317,13 @@ static int tcmu_check_expired_cmd(int id, void *p, void *data)
>  		 * target_complete_cmd will translate this to LUN COMM FAILURE
>  		 */
>  		scsi_status = SAM_STAT_CHECK_CONDITION;
> +		list_del_init(&cmd->queue_entry);
>  	} else {
> +		list_del_init(&cmd->queue_entry);
>  		idr_remove(&udev->commands, id);
>  		tcmu_free_cmd(cmd);
>  		scsi_status = SAM_STAT_TASK_SET_FULL;
>  	}
> -	list_del_init(&cmd->queue_entry);
>  
>  	pr_debug("Timing out cmd %u on dev %s that is %s.\n",
>  		 id, udev->name, is_running ? "inflight" : "queued");
> 

Reviewed-by: Mike Christie <mchristi@xxxxxxxxxx>



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux