All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Duncan <lduncan@suse.com>
To: mwilck@suse.com,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@lst.de>
Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	"David Disseldorp" <ddiss@suse.com>,
	"Jürgen Groß" <jgross@suse.com>,
	"Chaitanya Kulkarni" <Chaitanya.Kulkarni@wdc.com>
Subject: Re: [PATCH v2 2/2] target: pscsi: cleanup after failure in pscsi_map_sg()
Date: Wed, 24 Mar 2021 10:24:44 -0700	[thread overview]
Message-ID: <5f6daab0-cf0e-350b-26af-9345afb20fd5@suse.com> (raw)
In-Reply-To: <20210323212431.15306-2-mwilck@suse.com>

On 3/23/21 2:24 PM, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> If pscsi_map_sg() fails, make sure to drop references to already
> allocated bios.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>  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@suse.com>


  parent reply	other threads:[~2021-03-24 17:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 21:24 [PATCH v2 1/2] target: pscsi: avoid OOM in pscsi_map_sg() mwilck
2021-03-23 21:24 ` [PATCH v2 2/2] target: pscsi: cleanup after failure " mwilck
2021-03-24  7:14   ` Christoph Hellwig
2021-03-24 17:24   ` Lee Duncan [this message]
2021-03-24  7:14 ` [PATCH v2 1/2] target: pscsi: avoid OOM " Christoph Hellwig
2021-03-24 17:24 ` Lee Duncan
2021-03-25  3:53 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5f6daab0-cf0e-350b-26af-9345afb20fd5@suse.com \
    --to=lduncan@suse.com \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=ddiss@suse.com \
    --cc=hch@lst.de \
    --cc=jgross@suse.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mwilck@suse.com \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.