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

[Xen-changelog] [xen-4.1-testing] tmem: Prevent NULL dereference on error case


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-4.1-testing <patchbot@xxxxxxx>
  • Date: Wed, 14 Nov 2012 18:00:15 +0000
  • Delivery-date: Wed, 14 Nov 2012 18:00:53 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Matthew Daley <mattjd@xxxxxxxxx>
# Date 1352886194 -3600
# Node ID c8bf0d870e36acd8a9c045725067c7e14bb7469e
# Parent  26281a1650dcdf3878f4cab992995b8fce97a96e
tmem: Prevent NULL dereference on error case

If the client / pool IDs given to tmemc_save_get_next_page are invalid,
the calculation of pagesize will dereference NULL.

Fix this by moving the calculation below the appropriate NULL check.

Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx>
xen-unstable changeset: 26132:286ef4ced216
xen-unstable date: Mon Nov 12 08:34:57 UTC 2012
---


diff -r 26281a1650dc -r c8bf0d870e36 xen/common/tmem.c
--- a/xen/common/tmem.c Tue Nov 13 18:34:43 2012 +0000
+++ b/xen/common/tmem.c Wed Nov 14 10:43:14 2012 +0100
@@ -2449,10 +2449,12 @@ static NOINLINE int tmemc_save_get_next_
     OID oid;
     int ret = 0;
     struct tmem_handle h;
-    unsigned int pagesize = 1 << (pool->pageshift+12);
+    unsigned int pagesize;
 
     if ( pool == NULL || is_ephemeral(pool) )
         return -1;
+
+    pagesize = 1 << (pool->pageshift + 12);
     if ( bufsize < pagesize + sizeof(struct tmem_handle) )
         return -ENOMEM;
 

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