From: Niklas Cassel <cassel@kernel.org>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: linux-ide@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] ata: libata-scsi: fix ata_scsi_security_inout_xlat() buffer length conversion
Date: Wed, 24 Jun 2026 14:09:12 +0200 [thread overview]
Message-ID: <ajvI6KEkggFcWNlk@ryzen> (raw)
In-Reply-To: <ajvErjEiGUuFm75I@ryzen>
On Wed, Jun 24, 2026 at 01:51:14PM +0200, Niklas Cassel wrote:
> So if this is not the case, I think the fix should be in SCSI.
> I guess we could add code in libata to return an error if INC_512 set to zero,
> and scsi_bufflen(scmd) (+ scmd->extra_len ?) is not a multiple of 512.
> But to me, for SECURITY PROTOCOL OUT, the current libata code looks correct.
s/scsi_bufflen()/TRANSFER LENGTH (cdb[6:9])/
> For your workaround, we should probably ensure that it is only applied for
> SECURITY PROTOCOL IN (rx). But... would we not be violating the SAT spec?
>
> If we get a SCSI command with a scsi_bufflen that is not 512 aligned, and we
> apply your workaround, we will transfer less than scsi_bufflen to the device
> (since you now round down instead of up), but AFAICT, when calling
> ata_scsi_qc_complete() + ata_scsi_qc_done(), nowhere do I see that we call
> scsi_set_resid(), to indicate that the transfer has been truncated (i.e.
> that we did not transfer all scsi_bufflen() number of bytes), so it seems to
> me that your workaround would silently truncate the transfer, without informing
> the upper layer (SCSI) that the result is truncated.
s/scsi_bufflen()/ALLOCATION LENGTH (cdb[6:9])/
Kind regards,
Niklas
next prev parent reply other threads:[~2026-06-24 12:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 9:09 [PATCH] ata: libata-scsi: fix ata_scsi_security_inout_xlat() buffer length conversion Damien Le Moal
2026-06-24 9:22 ` Hannes Reinecke
2026-06-24 9:24 ` Damien Le Moal
2026-06-24 9:34 ` Hannes Reinecke
2026-06-24 11:51 ` Niklas Cassel
2026-06-24 12:09 ` Niklas Cassel [this message]
2026-06-24 13:18 ` Damien Le Moal
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=ajvI6KEkggFcWNlk@ryzen \
--to=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=hch@lst.de \
--cc=linux-ide@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.