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

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



commit 4911963dd76abcc1f1770b118b7e4d04f584438b
Author:     Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
AuthorDate: Fri Mar 21 02:56:56 2014 +0100
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Fri Apr 4 16:26:16 2014 +0100

    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>
    (cherry picked from commit 51e18e41e39a682de5a2e60ad86048dc6344efec)
    (cherry picked from commit 03eb5134056d61167e6781eecf7e570b491bda73)
    (cherry picked from commit e3f630b73c159078a6991161c5255048b16d366f)
---
 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 251e2ad..8cb91d1 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#stable-4.2

_______________________________________________
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®.