Re: [PATCH v2 2/2] target: pscsi: cleanup after failure in pscsi_map_sg()

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

 



On 3/23/21 2:24 PM, mwilck@xxxxxxxx wrote:
> From: Martin Wilck <mwilck@xxxxxxxx>
> 
> If pscsi_map_sg() fails, make sure to drop references to already
> allocated bios.
> 
> Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
> ---
>  drivers/target/target_core_pscsi.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
> index 977362d..1c9aeab 100644
> --- a/drivers/target/target_core_pscsi.c
> +++ b/drivers/target/target_core_pscsi.c
> @@ -937,6 +937,14 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
>  
>  	return 0;
>  fail:
> +	if (bio)
> +		bio_put(bio);
> +	while (req->bio) {
> +		bio = req->bio;
> +		req->bio = bio->bi_next;
> +		bio_put(bio);
> +	}
> +	req->biotail = NULL;
>  	return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
>  }
>  
> 

Reviewed-by: Lee Duncan <lduncan@xxxxxxxx>




[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