linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/shmem: fix freeing new_attr in shmem_initxattrs()
@ 2020-07-03  6:56 Chengguang Xu
  2020-07-03 19:20 ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Chengguang Xu @ 2020-07-03  6:56 UTC (permalink / raw)
  To: hughd, akpm; +Cc: linux-mm, Chengguang Xu

new_attr is allocated with kvmalloc() so should be freed
with kvfree().

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 mm/shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index a0dbe62f8042..b2abca3f7f33 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3178,7 +3178,7 @@ static int shmem_initxattrs(struct inode *inode,
 		new_xattr->name = kmalloc(XATTR_SECURITY_PREFIX_LEN + len,
 					  GFP_KERNEL);
 		if (!new_xattr->name) {
-			kfree(new_xattr);
+			kvfree(new_xattr);
 			return -ENOMEM;
 		}
 
-- 
2.20.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-04  2:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-03  6:56 [PATCH] mm/shmem: fix freeing new_attr in shmem_initxattrs() Chengguang Xu
2020-07-03 19:20 ` Andrew Morton
2020-07-03 20:15   ` Hugh Dickins
2020-07-04  1:59     ` cgxu
2020-07-04  2:20       ` Hugh Dickins
2020-07-04  2:44         ` cgxu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox