All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chengguang Xu <cgxu519@mykernel.net>
To: hughd@google.com, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, Chengguang Xu <cgxu519@mykernel.net>
Subject: [PATCH] mm/shmem: fix freeing new_attr in shmem_initxattrs()
Date: Fri,  3 Jul 2020 14:56:36 +0800	[thread overview]
Message-ID: <20200703065636.20897-1-cgxu519@mykernel.net> (raw)

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




             reply	other threads:[~2020-07-03  6:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03  6:56 Chengguang Xu [this message]
2020-07-03 19:20 ` [PATCH] mm/shmem: fix freeing new_attr in shmem_initxattrs() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200703065636.20897-1-cgxu519@mykernel.net \
    --to=cgxu519@mykernel.net \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.