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

[Xen-changelog] [xen-unstable] xsm:acm: Fix nul dereference bug (take 2).



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1191216985 -3600
# Node ID 0416abdd0efd0be99edbc6337e3a8e5ef59a76ea
# Parent  db075ecf29b2c7bd677a9b61b6d4ef136f686aef
xsm:acm: Fix nul dereference bug (take 2).
Signed-off-by: George Coker <gscoker@xxxxxxxxxxxxxx>
---
 xen/include/xsm/acm/acm_core.h  |    2 +-
 xen/include/xsm/acm/acm_hooks.h |    4 ++--
 xen/xsm/acm/acm_core.c          |   10 +++++++---
 3 files changed, 10 insertions(+), 6 deletions(-)

diff -r db075ecf29b2 -r 0416abdd0efd xen/include/xsm/acm/acm_core.h
--- a/xen/include/xsm/acm/acm_core.h    Mon Oct 01 06:35:40 2007 +0100
+++ b/xen/include/xsm/acm/acm_core.h    Mon Oct 01 06:36:25 2007 +0100
@@ -154,7 +154,7 @@ static inline int acm_array_append_tuple
 
 /* protos */
 int acm_init_domain_ssid(struct domain *, ssidref_t ssidref);
-void acm_free_domain_ssid(struct acm_ssid_domain *ssid);
+void acm_free_domain_ssid(struct domain *);
 int acm_init_binary_policy(u32 policy_code);
 int acm_set_policy(XEN_GUEST_HANDLE_64(void) buf, u32 buf_size);
 int do_acm_set_policy(void *buf, u32 buf_size, int is_bootpolicy,
diff -r db075ecf29b2 -r 0416abdd0efd xen/include/xsm/acm/acm_hooks.h
--- a/xen/include/xsm/acm/acm_hooks.h   Mon Oct 01 06:35:40 2007 +0100
+++ b/xen/include/xsm/acm/acm_hooks.h   Mon Oct 01 06:36:25 2007 +0100
@@ -258,7 +258,7 @@ static inline void acm_domain_destroy(st
             acm_secondary_ops->domain_destroy(ssid, d);
         /* free security ssid for the destroyed domain (also if null policy */
         acm_domain_ssid_off_list(ssid);
-        acm_free_domain_ssid((struct acm_ssid_domain *)(ssid));
+        acm_free_domain_ssid(d);
     }
 }
 
@@ -294,7 +294,7 @@ static inline int acm_domain_create(stru
     {
         acm_domain_ssid_onto_list(d->ssid);
     } else {
-        acm_free_domain_ssid(d->ssid);
+        acm_free_domain_ssid(d);
     }
 
 error_out:
diff -r db075ecf29b2 -r 0416abdd0efd xen/xsm/acm/acm_core.c
--- a/xen/xsm/acm/acm_core.c    Mon Oct 01 06:35:40 2007 +0100
+++ b/xen/xsm/acm/acm_core.c    Mon Oct 01 06:36:25 2007 +0100
@@ -361,7 +361,7 @@ int acm_init_domain_ssid(struct domain *
     {
         printk("%s: ERROR instantiating individual ssids for domain 0x%02x.\n",
                __func__, subj->domain_id);
-        acm_free_domain_ssid(ssid);
+        acm_free_domain_ssid(subj);
         return ACM_INIT_SSID_ERROR;
     }
 
@@ -372,8 +372,10 @@ int acm_init_domain_ssid(struct domain *
 
 
 void
-acm_free_domain_ssid(struct acm_ssid_domain *ssid)
-{
+acm_free_domain_ssid(struct domain *d)
+{
+    struct acm_ssid_domain *ssid = d->ssid;
+    
     /* domain is already gone, just ssid is left */
     if (ssid == NULL)
         return;
@@ -387,6 +389,8 @@ acm_free_domain_ssid(struct acm_ssid_dom
     ssid->secondary_ssid = NULL;
 
     xfree(ssid);
+    d->ssid = NULL;
+    
     printkd("%s: Freed individual domain ssid (domain=%02x).\n",
             __func__, id);
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.