| Date | Wed, 3 Dec 2008 11:51:30 -0800 | From | Greg KH <> | Subject | [patch 047/104] libata: Avoid overflow in libata when tf->hba_lbal > 127 |
| |
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------ From: Chuck Ebbert <cebbert@redhat.com>
Combination of these two upstream patches:
ba14a9c291aa867896a90b3571fcc1c3759942ff libata: Avoid overflow in ata_tf_to_lba48() when tf->hba_lbal > 127
44901a96847b9967c057832b185e2f34ee6a14e5 libata: Avoid overflow in ata_tf_read_block() when tf->hba_lbal > 127
Originally written by Roland Dreier, but backported by Chuck.
Cc: Roland Dreier <rdreier@cisco.com> Cc: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Chuck Ebbert <cebbert@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
--- drivers/ata/libata-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -551,7 +551,7 @@ u64 ata_tf_read_block(struct ata_taskfil if (tf->flags & ATA_TFLAG_LBA48) { block |= (u64)tf->hob_lbah << 40; block |= (u64)tf->hob_lbam << 32; - block |= tf->hob_lbal << 24; + block |= (u64)tf->hob_lbal << 24; } else block |= (tf->device & 0xf) << 24; @@ -1207,7 +1207,7 @@ u64 ata_tf_to_lba48(const struct ata_tas sectors |= ((u64)(tf->hob_lbah & 0xff)) << 40; sectors |= ((u64)(tf->hob_lbam & 0xff)) << 32; - sectors |= (tf->hob_lbal & 0xff) << 24; + sectors |= ((u64)(tf->hob_lbal & 0xff)) << 24; sectors |= (tf->lbah & 0xff) << 16; sectors |= (tf->lbam & 0xff) << 8; sectors |= (tf->lbal & 0xff);
|