• Niklas Cassel's avatar
    ata: libata: only set sense valid flag if sense data is valid · 4b89ad8e
    Niklas Cassel authored
    While this shouldn't be needed if all devices that claim that they
    support NCQ autosense (ata_id_has_ncq_autosense()) and/or the sense
    data reporting feature (ata_id_has_sense_reporting()), actually
    supported those features.
    
    However, there might be some old ATA devices that either have these
    bits set, even when they don't support those features, or they simply
    return malformed data when using those features.
    
    These devices should be quirked, but in order to try to minimize the
    impact for the users of these such devices, it was suggested by Damien
    Le Moal that it might be a good idea to sanity check the sense data
    received from the device. If the sense data looks bogus, then the
    sense data is never added to the scsi_cmnd command.
    
    Introduce a new function, ata_scsi_sense_is_valid(), and use it in all
    places where sense data is received from the device.
    Suggested-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
    Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
    Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
    4b89ad8e
libata.h 9.79 KB