Linux ATA/IDE development
 help / color / mirror / Atom feed
* [PATCH] ata: libata-scsi: set the field pointer when rejecting CDL
@ 2026-10-29 11:03 shao.mingyin
  2026-11-03 21:04 ` Niklas Cassel
  0 siblings, 1 reply; 4+ messages in thread
From: shao.mingyin @ 2026-10-29 11:03 UTC (permalink / raw)
  To: dlemoal, cassel, linux-ide; +Cc: linux-kernel

From: Shao Mingyin <shao.mingyin@zte.com.cn>

ata_mselect_control_ata_feature() rejects enabling CDL while NCQ
priority is enabled, but unlike its other error branches it returns
without setting *fp.

ata_scsi_mode_select_xlat() initializes fp to 0xffff and, when the
handler fails, adds the mode select header and block descriptor lengths
to it.  The resulting sense data then reports a field pointer far
outside of the submitted parameter list instead of the byte that has to
be changed.

Set *fp to the beginning of the mode page data, as the other branches of
this function do.

Fixes: df60f9c64576 ("scsi: ata: libata: Add ATA feature control sub-page translation")
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 5cde90fe594e..c07c1ff09757 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4494,6 +4494,7 @@ static int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc,
 		if (dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLED) {
 			ata_dev_err(dev,
 				"NCQ priority must be disabled to enable CDL\n");
+			*fp = 0;
 			return -EINVAL;
 		}
 		ata_dev_dbg(dev, "Enabling CDL\n");

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-04  1:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29 11:03 [PATCH] ata: libata-scsi: set the field pointer when rejecting CDL shao.mingyin
2026-11-03 21:04 ` Niklas Cassel
2026-11-03 21:18   ` Niklas Cassel
2026-11-04  1:55     ` shao.mingyin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox