Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Ubuntu Kernel Team (http://www.linux-archive.org/ubuntu-kernel-team/)
-   -   xen: Check for NULL pointer before using pgd (http://www.linux-archive.org/ubuntu-kernel-team/542402-xen-check-null-pointer-before-using-pgd.html)

Stefan Bader 06-21-2011 07:48 AM

xen: Check for NULL pointer before using pgd
 
In pgd_alloc(), the test for the new pgd being NULL is done
after it has already been used for test_and_unpin(). Do that
check before.

BugLink: http://bugs.launchpad.net/bugs/705562

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
arch/x86/mm/pgtable_32-xen.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/x86/mm/pgtable_32-xen.c b/arch/x86/mm/pgtable_32-xen.c
index 34c7320..021e29e 100644
--- a/arch/x86/mm/pgtable_32-xen.c
+++ b/arch/x86/mm/pgtable_32-xen.c
@@ -357,9 +357,12 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
pmd_t **pmds = NULL;
unsigned long flags;

+ if (!pgd)
+ return NULL;
+
pgd_test_and_unpin(pgd);

- if (PTRS_PER_PMD == 1 || !pgd)
+ if (PTRS_PER_PMD == 1)
return pgd;

#ifdef CONFIG_XEN
--
1.7.4.1


--------------080807080104060808040303
Content-Type: text/x-diff;
name="0002-xen-Avoid-double-list-adds-frees-of-pgds.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="0002-xen-Avoid-double-list-adds-frees-of-pgds.patch"


All times are GMT. The time now is 03:14 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.