diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-04-05 23:08:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-04-05 23:08:55 -0400 |
commit | f654f0fc0bd3f1b0ec76e654bf1cc21f33382241 (patch) | |
tree | 0fb7f1a75877f4a371a02bf0885000478d3c957a /fs | |
parent | 4f1cbe078546914538d8aabba04db984da68dcbf (diff) | |
parent | 9002b21465fa4d829edfc94a5a441005cffaa972 (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton:
"14 fixes"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
kernel/sysctl.c: fix out-of-bounds access when setting file-max
mm/util.c: fix strndup_user() comment
sh: fix multiple function definition build errors
MAINTAINERS: add maintainer and replacing reviewer ARM/NUVOTON NPCM
MAINTAINERS: fix bad pattern in ARM/NUVOTON NPCM
mm: writeback: use exact memcg dirty counts
psi: clarify the units used in pressure files
mm/huge_memory.c: fix modifying of page protection by insert_pfn_pmd()
hugetlbfs: fix memory leak for resv_map
mm: fix vm_fault_t cast in VM_FAULT_GET_HINDEX()
lib/lzo: fix bugs for very short or empty input
include/linux/bitrev.h: fix constant bitrev
kmemleak: powerpc: skip scanning holes in the .bss section
lib/string.c: implement a basic bcmp
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hugetlbfs/inode.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index ec32fece5e1e..9285dd4f4b1c 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -755,11 +755,17 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, | |||
755 | umode_t mode, dev_t dev) | 755 | umode_t mode, dev_t dev) |
756 | { | 756 | { |
757 | struct inode *inode; | 757 | struct inode *inode; |
758 | struct resv_map *resv_map; | 758 | struct resv_map *resv_map = NULL; |
759 | 759 | ||
760 | resv_map = resv_map_alloc(); | 760 | /* |
761 | if (!resv_map) | 761 | * Reserve maps are only needed for inodes that can have associated |
762 | return NULL; | 762 | * page allocations. |
763 | */ | ||
764 | if (S_ISREG(mode) || S_ISLNK(mode)) { | ||
765 | resv_map = resv_map_alloc(); | ||
766 | if (!resv_map) | ||
767 | return NULL; | ||
768 | } | ||
763 | 769 | ||
764 | inode = new_inode(sb); | 770 | inode = new_inode(sb); |
765 | if (inode) { | 771 | if (inode) { |
@@ -794,8 +800,10 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, | |||
794 | break; | 800 | break; |
795 | } | 801 | } |
796 | lockdep_annotate_inode_mutex_key(inode); | 802 | lockdep_annotate_inode_mutex_key(inode); |
797 | } else | 803 | } else { |
798 | kref_put(&resv_map->refs, resv_map_release); | 804 | if (resv_map) |
805 | kref_put(&resv_map->refs, resv_map_release); | ||
806 | } | ||
799 | 807 | ||
800 | return inode; | 808 | return inode; |
801 | } | 809 | } |