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

[Xen-changelog] [xen master] PV-GRUB: fix blk access at end of disk



commit 51e18e41e39a682de5a2e60ad86048dc6344efec
Author:     Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
AuthorDate: Fri Mar 21 02:56:56 2014 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Fri Mar 21 11:49:24 2014 +0000

    PV-GRUB: fix blk access at end of disk
    
    GRUB usually always loads a whole disk track, even if that means going
    beyond the end of the disk.  We thus have to gracefully return an error,
    instead of letting the blkfront go panic.
    
    Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 stubdom/grub/mini-os.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/stubdom/grub/mini-os.c b/stubdom/grub/mini-os.c
index 8cecf90..64ab962 100644
--- a/stubdom/grub/mini-os.c
+++ b/stubdom/grub/mini-os.c
@@ -126,6 +126,9 @@ biosdisk (int read, int drive, struct geometry *geometry,
     if (i >= blk_nb)
         return -1;
 
+    if (sector + nsec > geometry->total_sectors)
+      return -1;
+
     aiocb.aio_dev = blk_dev[i];
     aiocb.aio_buf = addr;
     aiocb.aio_nbytes = (size_t)nsec * blk_info[i].sector_size;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.