Skip to content

Commit 9273a8b

Browse files
toshikanitorvalds
authored andcommitted
devm_memremap_release(): fix memremap'd addr handling
The pmem driver calls devm_memremap() to map a persistent memory range. When the pmem driver is unloaded, this memremap'd range is not released so the kernel will leak a vma. Fix devm_memremap_release() to handle a given memremap'd address properly. Signed-off-by: Toshi Kani <[email protected]> Acked-by: Dan Williams <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Ross Zwisler <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent f8b7481 commit 9273a8b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/memremap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ EXPORT_SYMBOL(memunmap);
114114

115115
static void devm_memremap_release(struct device *dev, void *res)
116116
{
117-
memunmap(res);
117+
memunmap(*(void **)res);
118118
}
119119

120120
static int devm_memremap_match(struct device *dev, void *res, void *match_data)

0 commit comments

Comments
 (0)