Skip to content

Commit

Permalink
kmemleak: Release the object lock before calling put_object()
Browse files Browse the repository at this point in the history
The put_object() function may free the object if the use_count
dropped to 0. There shouldn't be further accesses to such object unless
it is known that the use_count is non-zero.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
  • Loading branch information
Catalin Marinas committed Oct 28, 2009
1 parent a6f5aa1 commit 0587da4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mm/kmemleak.c
Original file line number Diff line number Diff line change
Expand Up @@ -1025,11 +1025,14 @@ static void scan_block(void *_start, void *_end,
* added to the gray_list.
*/
object->count++;
if (color_gray(object))
if (color_gray(object)) {
list_add_tail(&object->gray_list, &gray_list);
else
put_object(object);
spin_unlock_irqrestore(&object->lock, flags);
continue;
}

spin_unlock_irqrestore(&object->lock, flags);
put_object(object);
}
}

Expand Down

0 comments on commit 0587da4

Please sign in to comment.