]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
mm.h: fix BUG_ON() condition in put_page_alloc_ref()
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 16 Jul 2019 11:29:02 +0000 (13:29 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 16 Jul 2019 11:29:02 +0000 (13:29 +0200)
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@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/include/xen/mm.h

index 5d0c19f01176eef61f9482155dae13ddd8efe873..cfea38f801b38c59fad298bc4ba70f9b0fd2161e 100644 (file)
@@ -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__ */