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

[Xen-changelog] [xen master] mm.h: fix BUG_ON() condition in put_page_alloc_ref()



commit 44a887d021de8f76183132bb5892c2c0840d3aca
Author:     Paul Durrant <paul.durrant@xxxxxxxxxx>
AuthorDate: Tue Jul 16 13:29:02 2019 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jul 16 13:29:02 2019 +0200

    mm.h: fix BUG_ON() condition in put_page_alloc_ref()
    
    The BUG_ON() was misplaced when this function was introduced in commit
    ec83f825 "mm.h: add helper function to test-and-clear _PGC_allocated".
    It will fire incorrectly if _PGC_allocated is already clear on entry. Thus
    it should be moved after the if statement.
    
    Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/include/xen/mm.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 5d0c19f011..cfea38f801 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -667,9 +667,11 @@ static inline void put_page_alloc_ref(struct page_info 
*page)
      * the caller holding an additional reference. I.e. the allocation
      * reference must never be the last reference held.
      */
-    BUG_ON((page->count_info & PGC_count_mask) <= 1);
     if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
+    {
+        BUG_ON((page->count_info & PGC_count_mask) <= 1);
         put_page(page);
+    }
 }
 
 #endif /* __XEN_MM_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.