Patch "ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting()" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting()

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ata-fix-ata_id_sense_reporting_enabled-and-ata_id_ha.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d8036aed98b4fd62d441f77330fcbbc6c75f9914
Author: Niklas Cassel <niklas.cassel@xxxxxxx>
Date:   Fri Sep 16 14:28:32 2022 +0200

    ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting()
    
    [ Upstream commit 690aa8c3ae308bc696ec8b1b357b995193927083 ]
    
    ACS-5 section
    7.13.6.41 Words 85..87, 120: Commands and feature sets supported or enabled
    states that:
    
    If bit 15 of word 86 is set to one, bit 14 of word 119 is set to one,
    and bit 15 of word 119 is cleared to zero, then word 119 is valid.
    
    If bit 15 of word 86 is set to one, bit 14 of word 120 is set to one,
    and bit 15 of word 120 is cleared to zero, then word 120 is valid.
    
    (This text also exists in really old ACS standards, e.g. ACS-3.)
    
    Currently, ata_id_sense_reporting_enabled() and
    ata_id_has_sense_reporting() both check bit 15 of word 86,
    but neither of them check that bit 14 of word 119 is set to one,
    or that bit 15 of word 119 is cleared to zero.
    
    Additionally, make ata_id_sense_reporting_enabled() return false
    if !ata_id_has_sense_reporting(), similar to how e.g.
    ata_id_flush_ext_enabled() returns false if !ata_id_has_flush_ext().
    
    Fixes: e87fd28cf9a2 ("libata: Implement support for sense data reporting")
    Signed-off-by: Niklas Cassel <niklas.cassel@xxxxxxx>
    Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/linux/ata.h b/include/linux/ata.h
index 40d150ad7e07..351e58312e7d 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -786,16 +786,21 @@ static inline bool ata_id_has_read_log_dma_ext(const u16 *id)
 
 static inline bool ata_id_has_sense_reporting(const u16 *id)
 {
-	if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
+	if (!(id[ATA_ID_CFS_ENABLE_2] & BIT(15)))
+		return false;
+	if ((id[ATA_ID_COMMAND_SET_3] & (BIT(15) | BIT(14))) != BIT(14))
 		return false;
-	return id[ATA_ID_COMMAND_SET_3] & (1 << 6);
+	return id[ATA_ID_COMMAND_SET_3] & BIT(6);
 }
 
 static inline bool ata_id_sense_reporting_enabled(const u16 *id)
 {
-	if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
+	if (!ata_id_has_sense_reporting(id))
+		return false;
+	/* ata_id_has_sense_reporting() == true, word 86 must have bit 15 set */
+	if ((id[ATA_ID_COMMAND_SET_4] & (BIT(15) | BIT(14))) != BIT(14))
 		return false;
-	return id[ATA_ID_COMMAND_SET_4] & (1 << 6);
+	return id[ATA_ID_COMMAND_SET_4] & BIT(6);
 }
 
 /**



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux