lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4999CFEB.3030204@ru.mvista.com>
Date:	Mon, 16 Feb 2009 23:43:23 +0300
From:	Sergei Shtylyov <sshtylyov@...mvista.com>
To:	Robert Hancock <hancockrwd@...il.com>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	ide <linux-ide@...r.kernel.org>, Jeff Garzik <jeff@...zik.org>,
	Mark Lord <liml@....ca>,
	Hanno Böck <hanno@...eck.de>
Subject: Re: [PATCH] libata: Don't trust current capacity values in identify
 words 57-58

Robert Hancock wrote:

> Hanno Böck reported a problem where an old Conner CP30254 240MB hard drive
> was reported as 1.1TB in capacity by libata:

> http://lkml.org/lkml/2009/2/13/134

> This was caused by libata trusting the drive's reported current capacity in 
> sectors in identify words 57 and 58 if the drive does not support LBA and the
> current CHS translation values appear valid. Unfortunately it seems older
> ATA specs were vague about what this field should contain and a number of drives
> used values with wrong byte order or that were totally bogus. There's no
> unique information that it conveys and so we can just calculate the number
> of sectors from the reported current CHS values.

> Signed-off-by: Robert Hancock <hancockrwd@...il.com>

> ---

> Should likely go into -next for testing for a while. Of course, the fact that
> this problem showed up in the first place shows that the number of people
> that test libata with such boat anchors is fairly small :-)

    It's been tested well enough for years in the IDE core I think.

> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 9fbf059..5389cbc 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -1327,7 +1327,7 @@ static u64 ata_id_n_sectors(const u16 *id)
>  			return ata_id_u32(id, 60);
>  	} else {
>  		if (ata_id_current_chs_valid(id))
> -			return ata_id_u32(id, 57);
> +			return id[54] * id[55] * id[56];

    We have mnemonics for these 3 words in <linux/ata.h>...

MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ