summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-07-16 16:25:53 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-07-16 16:25:53 -0700
commit055f763ca8c0eb69724cf5c1e5cb9511dce724f9 (patch)
tree0adebfec7e1eb0499df93f36e4793bd8d2539aef /core
parent21af78ff343844210a2241daa1b040c9d3c72178 (diff)
downloadsyslinux-055f763ca8c0eb69724cf5c1e5cb9511dce724f9.tar.gz
diskio: check early for an impossible LBA value for CHS requests
Make sure we don't end up trying to do a CHS request for a truly absurd value, that could possibly be misconverted. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'core')
-rw-r--r--core/fs/diskio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/fs/diskio.c b/core/fs/diskio.c
index 822314c5..cf9bf499 100644
--- a/core/fs/diskio.c
+++ b/core/fs/diskio.c
@@ -25,6 +25,9 @@ static int chs_rdwr_sectors(struct disk *disk, void *buf,
int retry;
uint32_t maxtransfer = disk->maxtransfer;
+ if (lba + disk->part_start >= 1024*256*63)
+ return 0; /* Impossible CHS request */
+
memset(&ireg, 0, sizeof ireg);
ireg.eax.b[1] = 0x02 + is_write;