Re: [PATCH] libata-core More robust parsing for multi_count(v5)

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

 



Hello, Mark.

Mark Lord wrote:
> Make libata more robust when parsing the multi_count
> field from a drive's identify data.  This prevents us from
> attempting to use dubious multi_count values ad infinitum.
> 
> Reset dev->multi_count to zero and reprobe it each time
> through this routine, as it can change on device reset.
> 
> Also ensure that the reported "maximum" value is valid
> and is a power of two, and that the reported "count" value
> is valid and also a power of two.  And that the "count"
> value is not greater than the "maximum" value.
> 
> Signed-off-by: Mark Lord <mlord@xxxxxxxxx>

Acked-by: Tejun Heo <tj@xxxxxxxxxx>

The patch looks safe to me although requiring power_of_2 on max seems
a bit too strict.  For configuration, ata_dev_configure() is the right
place.  I think the following should work.

* add dev->multi_limit which is initialized to -1 on ata_dev_init().

* during ata_dev_configure() if multi_limit < 0, set it to device max.

* set dev->multi to rounddown_pow_of_two(multi_limit) and issue
  SET_MULTI.

On EH side, ata_eh_speed_down() is the place to handle it.  It can
probably piggy back on ATA_EH_SPDN_SPEED_DOWN block.  All it has to do
is reducing dev->multi_limit.  dev_config will run later and apply it.
I'm not sure how the speed down strategy should exactly be tho.  It is
distinguisible from regular transfer errors?

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux