mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
gnttab: add missing version check to GNTTABOP_swap_grant_ref handling
... avoiding NULL derefs when the version to use wasn't set yet (via
GNTTABOP_setup_table or GNTTABOP_set_version).
This is CVE-2015-4163 / XSA-134.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
master commit: 5d5c09d853
master date: 2015-06-11 14:44:12 +0200
This commit is contained in:
1 parent
9176955cb8
commit
2f56b032bc
1 file changed
+3
@@ -2394,6 +2394,9 @@ __gnttab_swap_grant_ref(grant_ref_t ref_a, grant_ref_t ref_b)
|
||||
|
||||
spin_lock(>->lock);
|
||||
|
||||
if ( gt->gt_version == 0 )
|
||||
PIN_FAIL(out, GNTST_general_error, "grant table not yet set up\n");
|
||||
|
||||
/* Bounds check on the grant refs */
|
||||
if ( unlikely(ref_a >= nr_grant_entries(d->grant_table)))
|
||||
PIN_FAIL(out, GNTST_bad_gntref, "Bad ref-a (%d).\n", ref_a);
|
||||
|
||||