Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guangshuo Li" <lgs201920130244@gmail.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: qla2xxx: Fix BSG request hang on flash image validation failure
Date: Sat, 04 Jul 2026 17:58:12 +0000	[thread overview]
Message-ID: <20260704175812.9E1051F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260704174603.255881-1-lgs201920130244@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] Returning a negative error code to the BSG core truncates the reply payload, silently discarding vendor-specific diagnostic codes and breaking userspace API expectations.
--

commit 4f9a7c7b8cae4329ddb272256609d33b20e03bb0
Author: Guangshuo Li <lgs201920130244@gmail.com>

scsi: qla2xxx: Fix BSG request hang on flash image validation failure

This patch aims to fix a hang when flash image validation fails. It modifies
qla28xx_validate_flash_image() to return an error code instead of QLA_SUCCESS
when validation fails. This prevents the BSG request from remaining in-flight
until it times out.

> diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
> index 5e910b5ca670d..5b2201859f730 100644
> --- a/drivers/scsi/qla2xxx/qla_bsg.c
> +++ b/drivers/scsi/qla2xxx/qla_bsg.c
> @@ -3369,5 +3369,5 @@ static int qla28xx_validate_flash_image(struct bsg_job *bsg_job)
>  		bsg_job_done(bsg_job, bsg_reply->result,
>  			     bsg_reply->reply_payload_rcv_len);
>  
> -	return QLA_SUCCESS;
> +	return rval;

[Severity: Critical]
Does returning a negative error code here truncate the reply payload and
discard the vendor-specific diagnostic codes?

Earlier in qla28xx_validate_flash_image(), the code carefully constructs
an extended vendor status payload:

    if (rval)
        bsg_reply->reply_data.vendor_reply.vendor_rsp[0] =
            (state == 39) ? EXT_STATUS_IMG_SET_VALID_ERR :
            EXT_STATUS_IMG_SET_CONFIG_ERR;

However, when this function returns a negative error code instead of
QLA_SUCCESS, the BSG core intercepts it as a transport failure.

This occurs in the transport layer:

drivers/scsi/scsi_transport_fc.c:fc_bsg_host_dispatch() {
    ...
    if (ret) {
        /* transport error */
        job->reply_len = sizeof(uint32_t);
        ...
    }
    ...
}

Will this force the reply length to 4 bytes and silently drop the
reply_data payload, breaking userspace API expectations for these
validation errors?

>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260704174603.255881-1-lgs201920130244@gmail.com?part=1

      reply	other threads:[~2026-07-04 17:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-04 17:46 [PATCH] scsi: qla2xxx: Fix BSG request hang on flash image validation failure Guangshuo Li
2026-07-04 17:58 ` sashiko-bot [this message]

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=20260704175812.9E1051F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox