Patch "xen/xenbus: ensure xenbus_map_ring_valloc() returns proper grant status" has been added to the 5.4-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    xen/xenbus: ensure xenbus_map_ring_valloc() returns proper grant status

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xen-xenbus-ensure-xenbus_map_ring_valloc-returns-pro.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 00efe6aaf198b1d54991763c4739a4591962d056
Author: Juergen Gross <jgross@xxxxxxxx>
Date:   Thu Mar 26 09:03:58 2020 +0100

    xen/xenbus: ensure xenbus_map_ring_valloc() returns proper grant status
    
    [ Upstream commit 6b51fd3f65a22e3d1471b18a1d56247e246edd46 ]
    
    xenbus_map_ring_valloc() maps a ring page and returns the status of the
    used grant (0 meaning success).
    
    There are Xen hypervisors which might return the value 1 for the status
    of a failed grant mapping due to a bug. Some callers of
    xenbus_map_ring_valloc() test for errors by testing the returned status
    to be less than zero, resulting in no error detected and crashing later
    due to a not available ring page.
    
    Set the return value of xenbus_map_ring_valloc() to GNTST_general_error
    in case the grant status reported by Xen is greater than zero.
    
    This is part of XSA-316.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Wei Liu <wl@xxxxxxx>
    Link: https://lore.kernel.org/r/20200326080358.1018-1-jgross@xxxxxxxx
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
index e17ca81561713..a38292ef79f6d 100644
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -448,7 +448,14 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn);
 int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs,
 			   unsigned int nr_grefs, void **vaddr)
 {
-	return ring_ops->map(dev, gnt_refs, nr_grefs, vaddr);
+	int err;
+
+	err = ring_ops->map(dev, gnt_refs, nr_grefs, vaddr);
+	/* Some hypervisors are buggy and can return 1. */
+	if (err > 0)
+		err = GNTST_general_error;
+
+	return err;
 }
 EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux