aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorMike Kravetz <mike.kravetz@oracle.com>2019-04-05 18:39:06 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-04-05 16:02:31 -1000
commit58b6e5e8f1addd44583d61b0a03c0f5519527e35 (patch)
tree26842d20ba459c65b3345d36d93aab955d63a2af /mm
parentmm: fix vm_fault_t cast in VM_FAULT_GET_HINDEX() (diff)
downloadlinux-dev-58b6e5e8f1addd44583d61b0a03c0f5519527e35.tar.xz
linux-dev-58b6e5e8f1addd44583d61b0a03c0f5519527e35.zip
hugetlbfs: fix memory leak for resv_map
When mknod is used to create a block special file in hugetlbfs, it will allocate an inode and kmalloc a 'struct resv_map' via resv_map_alloc(). inode->i_mapping->private_data will point the newly allocated resv_map. However, when the device special file is opened bd_acquire() will set inode->i_mapping to bd_inode->i_mapping. Thus the pointer to the allocated resv_map is lost and the structure is leaked. Programs to reproduce: mount -t hugetlbfs nodev hugetlbfs mknod hugetlbfs/dev b 0 0 exec 30<> hugetlbfs/dev umount hugetlbfs/ resv_map structures are only needed for inodes which can have associated page allocations. To fix the leak, only allocate resv_map for those inodes which could possibly be associated with page allocations. Link: http://lkml.kernel.org/r/20190401213101.16476-1-mike.kravetz@oracle.com Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Reported-by: Yufen Yu <yuyufen@huawei.com> Suggested-by: Yufen Yu <yuyufen@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
0 files changed, 0 insertions, 0 deletions