Re: [PATCH v7 01/11] scsi: free sgtables in case command setup fails

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

 



On 2020-04-17 05:15, Johannes Thumshirn wrote:
> @@ -1190,6 +1190,7 @@ static blk_status_t scsi_setup_cmnd(struct scsi_device *sdev,
>  		struct request *req)
>  {
>  	struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
> +	blk_status_t ret;
>  
>  	if (!blk_rq_bytes(req))
>  		cmd->sc_data_direction = DMA_NONE;
> @@ -1199,9 +1200,14 @@ static blk_status_t scsi_setup_cmnd(struct scsi_device *sdev,
>  		cmd->sc_data_direction = DMA_FROM_DEVICE;
>  
>  	if (blk_rq_is_scsi(req))
> -		return scsi_setup_scsi_cmnd(sdev, req);
> +		ret = scsi_setup_scsi_cmnd(sdev, req);
>  	else
> -		return scsi_setup_fs_cmnd(sdev, req);
> +		ret = scsi_setup_fs_cmnd(sdev, req);
> +
> +	if (ret != BLK_STS_OK)
> +		scsi_free_sgtables(cmd);
> +
> +	return ret;
>  }

If this patch fixes the bug reported in
https://bugzilla.kernel.org/show_bug.cgi?id=205595, please mention this.

How about adding __must_check to scsi_setup_fs_cmnd()?

Thanks,

Bart.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux