From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
stable <stable@kernel.org>
Subject: Re: [PATCH] scsi: ses: Handle positive SCSI error from ses_recv_diag()
Date: Mon, 23 Feb 2026 17:03:20 +0100 [thread overview]
Message-ID: <2026022355-dress-revoke-89ea@gregkh> (raw)
In-Reply-To: <2026022301-bony-overstock-a07f@gregkh>
On Mon, Feb 23, 2026 at 04:44:59PM +0100, Greg Kroah-Hartman wrote:
> ses_recv_diag() can return a positive value, which also means that an
> error happened, so do not only test for negative values.
>
> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
> Cc: stable <stable@kernel.org>
> Assisted-by: gkh_clanker_2000
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/scsi/ses.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
> index 35101e9b7ba7..128042c734cc 100644
> --- a/drivers/scsi/ses.c
> +++ b/drivers/scsi/ses.c
> @@ -215,7 +215,7 @@ static unsigned char *ses_get_page2_descriptor(struct enclosure_device *edev,
> unsigned char *type_ptr = ses_dev->page1_types;
> unsigned char *desc_ptr = ses_dev->page2 + 8;
>
> - if (ses_recv_diag(sdev, 2, ses_dev->page2, ses_dev->page2_len) < 0)
> + if (ses_recv_diag(sdev, 2, ses_dev->page2, ses_dev->page2_len))
> return NULL;
>
> for (i = 0; i < ses_dev->page1_num_types; i++, type_ptr += 4) {
> --
> 2.53.0
>
Along these lines, any specific reason why the following code in
ses_enclosure_data_process() doesn't also check the return value of
ses_recv_diag():
/* re-read page 10 */
if (ses_dev->page10)
ses_recv_diag(sdev, 10, ses_dev->page10, ses_dev->page10_len);
/* Page 7 for the descriptors is optional */
result = ses_recv_diag(sdev, 7, hdr_buf, INIT_ALLOC_SIZE);
if (result)
goto simple_populate;
Is that because re-reading always succeeds, or because it can fail and
we just want to ignore it? It feels odd that the "optional" read
command for page 7 is checked by not page 10. But hey, scsi is odd :)
thank,s
greg k-h
next prev parent reply other threads:[~2026-02-23 16:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 15:44 [PATCH] scsi: ses: Handle positive SCSI error from ses_recv_diag() Greg Kroah-Hartman
2026-02-23 16:03 ` Greg Kroah-Hartman [this message]
2026-02-23 19:30 ` James Bottomley
2026-03-13 7:27 ` Hannes Reinecke
2026-03-20 2:36 ` 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=2026022355-dress-revoke-89ea@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox