diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-10-28 09:33:11 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2009-10-28 13:07:54 -0400 |
commit | 0587da40be78d3704a48d3e9a619183891727f5f (patch) | |
tree | 3a7e889902990c86a3c76abdf4e39c20360af47b /mm | |
parent | a6f5aa1ea05686ad6e84593a00a04161e6dfb3a3 (diff) |
kmemleak: Release the object lock before calling put_object()
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>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/kmemleak.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 96106358e042..f06c0921e472 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c | |||
@@ -1025,11 +1025,14 @@ static void scan_block(void *_start, void *_end, | |||
1025 | * added to the gray_list. | 1025 | * added to the gray_list. |
1026 | */ | 1026 | */ |
1027 | object->count++; | 1027 | object->count++; |
1028 | if (color_gray(object)) | 1028 | if (color_gray(object)) { |
1029 | list_add_tail(&object->gray_list, &gray_list); | 1029 | list_add_tail(&object->gray_list, &gray_list); |
1030 | else | 1030 | spin_unlock_irqrestore(&object->lock, flags); |
1031 | put_object(object); | 1031 | continue; |
1032 | } | ||
1033 | |||
1032 | spin_unlock_irqrestore(&object->lock, flags); | 1034 | spin_unlock_irqrestore(&object->lock, flags); |
1035 | put_object(object); | ||
1033 | } | 1036 | } |
1034 | } | 1037 | } |
1035 | 1038 | ||