[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-4.2-testing] tmem: Prevent NULL dereference on error case
# HG changeset patch # User Matthew Daley <mattjd@xxxxxxxxx> # Date 1352885871 -3600 # Node ID ea0380b7611691b352bce509bcf18e5dd7e1e4f0 # Parent 839e5d95d483586dac5073cb59f845910588b000 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 839e5d95d483 -r ea0380b76116 xen/common/tmem.c --- a/xen/common/tmem.c Tue Nov 13 18:00:57 2012 +0000 +++ b/xen/common/tmem.c Wed Nov 14 10:37:51 2012 +0100 @@ -2446,10 +2446,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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |